MCPcopy Index your code
hub / github.com/lawlite19/MachineLearning_Python / plot_data

Function plot_data

SVM/SVM_scikit-learn.py:31–40  ·  view source on GitHub ↗
(X, y)

Source from the content-addressed store, hash-verified

29
30# 作图
31def plot_data(X, y):
32 plt.figure(figsize=(10, 8))
33 pos = np.where(y == 1) # 找到y=1的位置
34 neg = np.where(y == 0) # 找到y=0的位置
35 p1, = plt.plot(np.ravel(X[pos, 0]), np.ravel(X[pos, 1]), 'ro', markersize=8)
36 p2, = plt.plot(np.ravel(X[neg, 0]), np.ravel(X[neg, 1]), 'g^', markersize=8)
37 plt.xlabel("X1")
38 plt.ylabel("X2")
39 plt.legend([p1, p2], ["y==1", "y==0"])
40 return plt
41
42
43# 画决策边界

Callers 2

SVMFunction · 0.70
plot_decisionBoundaryFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected