MCPcopy Index your code
hub / github.com/wepe/MachineLearning / test_linear

Function test_linear

SVM/SVM_by_QP/testSVM.py:101–113  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

99 pl.show()
100
101def test_linear():
102 X1, y1, X2, y2 = gen_lin_separable_data()
103 X_train, y_train = split_train(X1, y1, X2, y2)
104 X_test, y_test = split_test(X1, y1, X2, y2)
105
106 clf = SVM()
107 clf.fit(X_train, y_train)
108
109 y_predict = clf.predict(X_test)
110 correct = np.sum(y_predict == y_test)
111 print "%d out of %d predictions correct" % (correct, len(y_predict))
112
113 plot_margin(X_train[y_train==1], X_train[y_train==-1], clf)
114
115def test_non_linear():
116 X1, y1, X2, y2 = gen_non_lin_separable_data()

Callers

nothing calls this directly

Calls 7

fitMethod · 0.95
predictMethod · 0.95
gen_lin_separable_dataFunction · 0.85
split_trainFunction · 0.85
split_testFunction · 0.85
SVMClass · 0.85
plot_marginFunction · 0.85

Tested by

no test coverage detected