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

Function test_soft

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

Source from the content-addressed store, hash-verified

131 plot_contour(X_train[y_train==1], X_train[y_train==-1], clf)
132
133def test_soft():
134 X1, y1, X2, y2 = gen_lin_separable_overlap_data()
135 X_train, y_train = split_train(X1, y1, X2, y2)
136 X_test, y_test = split_test(X1, y1, X2, y2)
137
138
139
140 clf = SVM(C=0.1)
141 clf.fit(X_train, y_train)
142
143 y_predict = clf.predict(X_test)
144 correct = np.sum(y_predict == y_test)
145 print "%d out of %d predictions correct" % (correct, len(y_predict))
146
147 plot_contour(X_train[y_train==1], X_train[y_train==-1], clf)
148
149
150if __name__ == "__main__":

Callers

nothing calls this directly

Calls 7

fitMethod · 0.95
predictMethod · 0.95
split_trainFunction · 0.85
split_testFunction · 0.85
SVMClass · 0.85
plot_contourFunction · 0.85

Tested by

no test coverage detected