()
| 99 | pl.show() |
| 100 | |
| 101 | def 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 | |
| 115 | def test_non_linear(): |
| 116 | X1, y1, X2, y2 = gen_non_lin_separable_data() |
nothing calls this directly
no test coverage detected