所以我有一个具有这种结构的数据集
输入
输出
我想看看单层感知器实际上是如何做到的。
我从here那里获得了这段代码
plot_x = np.array([np.min(x[:, 0] - 10), np.max(x[:, 1]) + 10])
#This is for 2 weights
plot_y = - 1 / W[1] * (W[0] * plot_x + b) # comes from, w0*x + w1*y + b = 0 then y = (-1/w1) (w0*x + b)
plt.scatter(x[:, 0], x[:, 1], c=y, s=100, cmap='viridis')
plt.plot(plot_x, plot_y, color='k', linewidth=2)
plt.xlim([-99999, 99999])
plt.ylim([-99999, 99999])
plt.show()
我的问题是,如何从这些权重中计算plot_y
?
我(非常)是matplotlib的新手,这是我第一次尝试进行可视化。
据我了解,plot_y会创建一条线来划分类别。