Skip to content

Commit 9cdc513

Browse files
committed
handle 2nd sparse matrix validation
1 parent 1f04e0b commit 9cdc513

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

hdbscan/hdbscan_.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,12 @@ def fit(self, X, y=None):
829829
if self.metric != 'precomputed':
830830
X = check_array(X, accept_sparse='csr')
831831
self._raw_data = X
832+
elif issparse(X):
833+
# Handle sparse precomputed distance matrices separately
834+
X = check_array(X, accept_sparse='csr')
832835
else:
836+
# Only non-sparse, precomputed distance matrices are allowed
837+
# to have numpy.inf values indicating missing distances
833838
check_precomputed_distance_matrix(X)
834839

835840
kwargs = self.get_params()

0 commit comments

Comments
 (0)