決策邊界一般是更復雜的,不只是一個線等(在2D維的情況),最好是使用一般的情況下,代碼,這也將很好地線性分類器工作。最簡單的想法是繪製決策功能
# X - some data in 2dimensional np.array
x_min, x_max = X[:, 0].min() - 1, X[:, 0].max() + 1
y_min, y_max = X[:, 1].min() - 1, X[:, 1].max() + 1
xx, yy = np.meshgrid(np.arange(x_min, x_max, h),
np.arange(y_min, y_max, h))
# here "model" is your model's prediction (classification) function
Z = model(np.c_[xx.ravel(), yy.ravel()])
# Put the result into a color plot
Z = Z.reshape(xx.shape)
plt.contourf(xx, yy, Z, cmap=pl.cm.Paired)
plt.axis('off')
# Plot also the training points
plt.scatter(X[:, 0], X[:, 1], c=Y, cmap=pl.cm.Paired)
一些例子的等高線圖,從sklearn
文檔
![enter image description here](https://i.stack.imgur.com/UG1RU.png)
所以這裏ž將是導致權重向量? – anonuser0428
沒有,'Z'是分類的矩陣,如果神經網絡只包含兩個權重(沒有偏置)'Z(X,Y)= SGN(W1 * X + W2 * Y)' – lejlot
,從而在這種情況下在將參數傳遞給我的模型的行上,我實際上會傳遞我正在分析的數據?還是應該已經對我的分類器進行了培訓,然後傳遞了這些數據? – anonuser0428