8000 FIX use None as default in HDBSCAN (#26650) · scikit-learn/scikit-learn@b1485a1 · GitHub
[go: up one dir, main page]

Skip to content

Commit b1485a1

Browse files
glemaitrejeremiedbb
authored andcommitted
FIX use None as default in HDBSCAN (#26650)
1 parent 894b335 commit b1485a1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

sklearn/cluster/_hdbscan/hdbscan.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ def _brute_mst(mutual_reachability, min_samples):
9898
Returns
9999
-------
100100
mst : ndarray of shape (n_samples - 1,), dtype=MST_edge_dtype
101-
The MST representation of the mutual-reahability graph. The MST is
102-
represented as a collecteion of edges.
101+
The MST representation of the mutual-reachability graph. The MST is
102+
represented as a collection of edges.
103103
"""
104104
if not issparse(mutual_reachability):
105105
return mst_from_mutual_reachability(mutual_reachability)
@@ -139,8 +139,8 @@ def _process_mst(min_spanning_tree):
139139
Parameters
140140
----------
141141
min_spanning_tree : ndarray of shape (n_samples - 1,), dtype=MST_edge_dtype
142-
The MST representation of the mutual-reahability graph. The MST is
143-
represented as a collecteion of edges.
142+
The MST representation of the mutual-reachability graph. The MST is
143+
represented as a collection of edges.
144144
145145
Returns
146146
-------
@@ -654,7 +654,7 @@ def __init__(
654654
alpha=1.0,
655655
algorithm="auto",
656656
leaf_size=40,
657-
n_jobs=4,
657+
n_jobs=None,
658658
cluster_selection_method="eom",
659659
allow_single_cluster=False,
660660
store_centers=None,
@@ -721,10 +721,10 @@ def fit(self, X, y=None):
721721

722722
# Samples with missing data are denoted by the presence of
723723
# `np.nan`
724-
missing_index = list(np.isnan(reduced_X).nonzero()[0])
724+
missing_index = np.isnan(reduced_X).nonzero()[0]
725725

726726
# Outlier samples are denoted by the presence of `np.inf`
727-
infinite_index = list(np.isinf(reduced_X).nonzero()[0])
727+
infinite_index = np.isinf(reduced_X).nonzero()[0]
728728

729729
# Continue with only finite samples
730730
finite_index = _get_finite_row_indices(X)
@@ -834,7 +834,7 @@ def fit(self, X, y=None):
834834
self._single_linkage_tree_,
835835
internal_to_raw,
836836
# There may be overlap for points w/ both `np.inf` and `np.nan`
837-
non_finite=set(infinite_index + missing_index),
837+
non_finite=set(np.hstack([infinite_index, missing_index])),
838838
)
839839
new_labels = np.empty(self._raw_data.shape[0], dtype=np.int32)
840840
new_labels[finite_index] = self.labels_

0 commit comments

Comments
 (0)
0