机器学习(一) 效果图实现代码

xmin, xmax = data[:,0].min(), data[:,0].max()
ymin, ymax = data[:,1].min(), data[:,1].max()

x = np.linspace(xmin,xmax, 1000)
y = np.linspace(ymin, ymax, 1000)
X,Y = np.meshgrid(x,y)

X_test = np.c_[X.ravel(), Y.ravel()]

y_logistic = logistic.predict(X_test)

plt.pcolormesh(X,Y,y_logistic.reshape(1000,1000))
plt.scatter(data[:, 0], data[:,1], c=target, cmap='rainbow')

算法模型实现效果图

原文地址:https://www.cnblogs.com/gugubeng/p/9803439.html