Skip to content

Commit 94744a5

Browse files
authored
Merge pull request #540 from jcfaracco/int
hdbscan: add support to other types of input integers
2 parents 7a6a095 + 1cabca6 commit 94744a5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

hdbscan/hdbscan_.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,8 @@ def hdbscan(
674674
if min_samples is None:
675675
min_samples = min_cluster_size
676676

677-
if type(min_samples) is not int or type(min_cluster_size) is not int:
677+
if not np.issubdtype(type(min_samples), np.integer) or \
678+
not np.issubdtype(type(min_cluster_size), np.integer):
678679
raise ValueError("Min samples and min cluster size must be integers!")
679680

680681
if min_samples <= 0 or min_cluster_size <= 0:
@@ -685,7 +686,7 @@ def hdbscan(
685686
if min_cluster_size == 1:
686687
raise ValueError("Min cluster size must be greater than one")
687688

688-
if type(cluster_selection_epsilon) is int:
689+
if np.issubdtype(type(cluster_selection_epsilon), np.integer):
689690
cluster_selection_epsilon = float(cluster_selection_epsilon)
690691

691692
if type(cluster_selection_epsilon) is not float or cluster_selection_epsilon < 0.0:

0 commit comments

Comments
 (0)