【发布时间】:2019-07-25 22:01:19
【问题描述】:
我无法理解预测 ys 以绘制图形的公式。
怎么会是ys = (-theta[0] - theta[1] * xs) / theta[2]?
fig, axes = plt.subplots(1, 3, sharex=True, sharey=True, figsize=(12, 3))
axes = axes.ravel()
for k, theta in enumerate(tha[:3]):
ax = axes[k]
xs = np.arange(0, 1, 0.1)
ys = (-theta[0] - theta[1] * xs) / theta[2]
ax.plot(xs, ys, lw=0.5)
dfa.query('label == 1').plot.scatter(x='x1', y='x2', ax=ax, color='blue')
dfa.query('label == -1').plot.scatter(x='x1', y='x2', ax=ax, color='red')
【问题讨论】:
-
你能指定你的 thetas 来自哪里吗?
-
theta_0、theta_1 和 theta_2 是模型训练参数。
-
我明白了,您能提供有关模型的更多详细信息吗?
-
在这个网站上:gtraskas.github.io/post/ex2 在评估逻辑回归部分下,他们使用了相同的公式(即 plot_y = -(theta[0] + theta[1] * plot_x ) / theta[2] ) 用于预测 y。但如果从哪里来?
-
用截图给你一些解释。对不起我的英语不好。如果需要可以为您提供一些额外的链接。
标签: python machine-learning logistic-regression