@@ 73-82 (lines=10) @@ | ||
70 | X = rnd.randn(10, 2) |
|
71 | y = np.hstack((-np.ones((5,)), np.ones((5,)))) |
|
72 | Z = rnd.randn(10, 2) + 1 |
|
73 | clf = ImportanceWeightedClassifier() |
|
74 | clf.fit(X, y, Z) |
|
75 | u_pred = clf.predict(Z) |
|
76 | labels = np.unique(y) |
|
77 | assert len(np.setdiff1d(np.unique(u_pred), labels)) == 0 |
|
78 |
@@ 28-37 (lines=10) @@ | ||
25 | """Test for fitting the model.""" |
|
26 | X = rnd.randn(10, 2) |
|
27 | y = np.hstack((-np.ones((5,)), np.ones((5,)))) |
|
28 | Z = rnd.randn(10, 2) + 1 |
|
29 | clf = SubspaceAlignedClassifier() |
|
30 | clf.fit(X, y, Z) |
|
31 | assert clf.is_trained |
|
32 | ||
33 | ||
34 | def test_predict(): |
|
35 | """Test for making predictions.""" |
|
36 | X = rnd.randn(10, 2) |
|
37 | y = np.hstack((-np.ones((5,)), np.ones((5,)))) |
|
38 | Z = rnd.randn(10, 2) + 1 |
|
39 | clf = SubspaceAlignedClassifier() |
|
40 | clf.fit(X, y, Z) |