Skip to content

Commit a9d51ca

Browse files
Fixing tests (again)
1 parent 3b8ac1b commit a9d51ca

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

test/metric_learn_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ class TestSDML(MetricTestCase):
7575
def test_iris(self):
7676
# Note: this is a flaky test, which fails for certain seeds.
7777
# TODO: un-flake it!
78-
np.random.seed(5555)
78+
rs = np.random.RandomState(5555)
7979

8080
sdml = SDML_Supervised(num_constraints=1500)
81-
sdml.fit(self.iris_points, self.iris_labels)
81+
sdml.fit(self.iris_points, self.iris_labels, random_state=rs)
8282
csep = class_separation(sdml.transform(), self.iris_labels)
8383
self.assertLess(csep, 0.25)
8484

test/test_fit_transform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_lfda(self):
9292
res_2 = lfda.fit_transform(self.X, self.y)
9393

9494
# signs may be flipped, that's okay
95-
if res_1[0,0] != res_2[0,0]:
95+
if np.sign(res_1[0,0]) != np.sign(res_2[0,0]):
9696
res_2 *= -1
9797
assert_array_almost_equal(res_1, res_2)
9898

0 commit comments

Comments
 (0)