8000 Add a test case for OPTICS bug (closes #12134) · scikit-learn/scikit-learn@dd95eba · GitHub
[go: up one dir, main page]

Skip to content

Commit dd95eba

Browse files
committed
Add a test case for OPTICS bug (closes #12134)
1 parent 8985a63 commit dd95eba

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sklearn/cluster/tests/test_optics.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,3 +459,11 @@ def test_precomputed_dists():
459459

460460
assert_allclose(clust1.reachability_, clust2.reachability_)
461461
assert_array_equal(clust1.labels_, clust2.labels_)
462+
463+
def test_processing_order():
464+
"""Unit test for bug in ca. version 0.20, see #12090"""
465+
Y = [[0], [10], [-10], [25]]
466+
clust = OPTICS(min_samples=3, max_eps=15).fit(Y)
467+
assert_array_equal(clust.reachability_, [np.inf, 10, 10, 15])
468+
assert_array_equal(clust.core_distances_, [10, 15, 20, 25])
469+
assert_array_equal(clust.ordering_, [0, 1, 2, 3])

0 commit comments

Comments
 (0)
0