使用Python生成3個類別的隨機樣本資料(2維資料)
使用線性分類器進行分類
效果要實作類似于這種

應該怎么實作啊
uj5u.com熱心網友回復:
要分析什么特征值吧,見別人搞過,但不知道怎么搞的uj5u.com熱心網友回復:
隨機資料代碼import numpy as np
import matplotlib
import matplotlib.pyplot as plt
fig=plt.figure()
data1=np.random.randn(150,2)
data2=np.random.randn(150,2)*[0.9,1.8]+[1,4]
data3=np.random.randn(150,2)*[0.5,0.5]+[3,3]
data4=np.random.randn(150,2)*[2,1]+[7,6]
ax=fig.add_subplot(111)
ax.scatter(x=data1[:,0],y=data1[:,1],label='class1',color='darkturquoise',marker='o')
ax.scatter(x=data2[:,0],y=data2[:,1],label='class2',color='blue',marker='^')
ax.scatter(x=data3[:,0],y=data3[:,1],label='class3',color='yellowgreen',marker='s')
ax.scatter(x=data4[:,0],y=data4[:,1],label='class4',color='red',marker='D')
ax.legend(loc='lower right')
plt.show()
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/192934.html
上一篇:商品比價爬蟲
下一篇:求助
