Skip to content

FIX Fixes test_compare_to_elki failure #19221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sklearn/cluster/_optics.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,9 @@ def compute_optics_graph(X, *, min_samples, max_eps, metric, p, metric_params,
working_memory=None)
# OPTICS puts an upper limit on these, use inf for undefined.
core_distances_[core_distances_ > max_eps] = np.inf
np.around(core_distances_,
decimals=np.finfo(core_distances_.dtype).precision,
out=core_distances_)

# Main OPTICS loop. Not parallelizable. The order that entries are
# written to the 'ordering_' list is important!
Expand Down Expand Up @@ -533,6 +536,7 @@ def _set_reach_dist(core_distances_, reachability_, predecessor_,
**_params).ravel()

rdists = np.maximum(dists, core_distances_[point_index])
np.around(rdists, decimals=np.finfo(rdists.dtype).precision, out=rdists)
improved = np.where(rdists < np.take(reachability_, unproc))
reachability_[unproc[improved]] = rdists[improved]
predecessor_[unproc[improved]] = point_index
Expand Down
10 changes: 0 additions & 10 deletions sklearn/cluster/tests/test_optics.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Authors: Shane Grigsby <refuge@rocktalus.com>
# Adrin Jalali <adrin.jalali@gmail.com>
# License: BSD 3 clause
import platform
import sys

import numpy as np
import pytest

Expand All @@ -17,10 +14,8 @@
from sklearn.utils._testing import assert_array_equal
from sklearn.utils._testing import assert_raise_message
from sklearn.utils._testing import assert_allclose
from sklearn.utils.fixes import sp_version, parse_version

from sklearn.cluster.tests.common import generate_clustered_data
from sklearn.utils import _IS_32BIT


rng = np.random.RandomState(0)
Expand Down Expand Up @@ -318,11 +313,6 @@ def test_processing_order():
assert_array_equal(clust.ordering_, [0, 1, 2, 3])


@pytest.mark.skipif(sp_version >= parse_version("1.6.0")
and (platform.machine() == "aarch64" or
(sys.platform == "linux" and _IS_32BIT)),
reason=("Test fails for SciPy 1.6.0 on ARM and on 32-bit "
"linux. See #19111"))
def test_compare_to_ELKI():
# Expected values, computed with (future) ELKI 0.7.5 using:
# java -jar elki.jar cli -dbc.in csv -dbc.filter FixedDBIDsFilter
Expand Down