Skip to content

Commit f606f13

Browse files
authored
Merge pull request #7061 from ales-erjavec/tests-mds-tolerance
[MNT] tests/mds: Fix tests w.r.t. current dev scikit-learn
2 parents c338b38 + 435c7f6 commit f606f13

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Orange/tests/test_manifold.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,26 @@ def test_mds_pca_init(self):
5757
n_components=2, dissimilarity=Euclidean, init_type='PCA',
5858
n_init=1)
5959
X = projector(self.iris).embedding_
60-
np.testing.assert_array_almost_equal(X[0], result)
60+
np.testing.assert_allclose(X[0], result, rtol=1e-3)
6161

6262
projector = MDS(
6363
n_components=2, dissimilarity='precomputed', init_type='PCA',
6464
n_init=1)
6565
X = projector(Euclidean(self.iris)).embedding_
66-
np.testing.assert_array_almost_equal(X[0], result)
66+
np.testing.assert_allclose(X[0], result, rtol=1e-3)
6767

6868
projector = MDS(
6969
n_components=2, dissimilarity='euclidean', init_type='PCA',
7070
n_init=1)
7171
X = projector(self.iris).embedding_
72-
np.testing.assert_array_almost_equal(X[0], result)
72+
np.testing.assert_allclose(X[0], result, rtol=1e-3)
7373

7474
projector = MDS(
7575
n_components=6, dissimilarity='euclidean', init_type='PCA',
7676
n_init=1)
7777
X = projector(self.iris[:5]).embedding_
78-
result = np.array([-0.31871, -0.064644, 0.015653, -1.5e-08, -4.3e-11, 0])
79-
np.testing.assert_array_almost_equal(np.abs(X[0]), np.abs(result))
78+
result = np.array([-0.31871, -0.064644, 0.015653, 0, 0, 0])
79+
np.testing.assert_allclose(np.abs(X[0]), np.abs(result), rtol=1e-3)
8080

8181
def test_isomap(self):
8282
for i in range(1, 4):

Orange/widgets/unsupervised/tests/test_owmds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def test_run_mds(self):
364364
[-2.9022707, -0.13465859],
365365
[-2.75267253, -0.33899134],
366366
[-2.74108069, 0.35393209]])
367-
np.testing.assert_almost_equal(array, result.embedding[:5])
367+
np.testing.assert_allclose(array, result.embedding[:5], rtol=1e-2, atol=1e-4)
368368
state.set_status.assert_called_once_with("Running...")
369369
self.assertGreater(state.set_partial_result.call_count, 2)
370370
self.assertGreater(state.set_progress_value.call_count, 2)

0 commit comments

Comments
 (0)