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