8000 [MRG] TST/FIX stop optics reachability failure on 32bit (#11916) · scikit-learn/scikit-learn@1c84b81 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1c84b81

Browse files
jnothmanrth
authored andcommitted
[MRG] TST/FIX stop optics reachability failure on 32bit (#11916)
1 parent 7ed61a2 commit 1c84b81

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

sklearn/cluster/tests/test_optics.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
from sklearn.metrics.cluster import contingency_matrix
1313
from sklearn.cluster.dbscan_ import DBSCAN
1414
from sklearn.utils.testing import assert_equal, assert_warns
15-
from sklearn.utils.testing import assert_array_almost_equal
1615
from sklearn.utils.testing import assert_array_equal
1716
from sklearn.utils.testing import assert_raise_message
17+
from sklearn.utils.testing import assert_allclose
18+
from sklearn.utils import _IS_32BIT
1819

1920
from sklearn.cluster.tests.common import generate_clustered_data
2021

@@ -405,4 +406,10 @@ def test_reach_dists():
405406
1.364861, 0.459580, 1.025370, 0.980304, 0.607592, 0.533907, 1.134650,
406407
0.446161, 0.629962]
407408

408-
assert_array_almost_equal(clust.reachability_, np.array(v))
409+
# FIXME: known failure in 32bit Linux; numerical imprecision results in
410+
# different ordering in quick_scan
411+
if _IS_32BIT: # pragma: no cover
412+
assert_allclose(clust.reachability_, np.array(v), rtol=1e-2)
413+
else:
414+
# we compare to truncated decimals, so use atol
415+
assert_allclose(clust.reachability_, np.array(v), atol=1e-5)

0 commit comments

Comments
 (0)
0