Skip to content
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

hdbscan: add support to other types of input integers #540

Merged
merged 1 commit into from
May 2, 2022

Conversation

jcfaracco
Copy link
Contributor

Both attributes like min_samples and min_cluster_size can be defined
using other types of integer like Numpy's int16, int32 and int64. This
should be also supported by HDBSCAN. This commit only extendes the check
to other types of integers.

For further example, you can test using:

import numpy as np

a = 10
b = np.int16(10)
c = np.int64(10)

print(isinstance(a, int))
print(isinstance(b, int))
print(isinstance(c, int))
print(np.issubdtype(type(a), np.integer))
print(np.issubdtype(type(b), np.integer))
print(np.issubdtype(type(c), np.integer))

The output is:

True
False
False
True
True
True

Signed-off-by: Julio Faracco jcfaracco@gmail.com

Both attributes like min_samples and min_cluster_size can be defined
using other types of integer like Numpy's int16, int32 and int64. This
should be also supported by HDBSCAN. This commit only extendes the check
to other types of integers.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
@lmcinnes
Copy link
Collaborator

lmcinnes commented May 2, 2022

Thanks. Hopefully no one needs to use a full size int64 for min_samples, but not erroring if it happens to be typed that way is very useful.

@lmcinnes lmcinnes merged commit 94744a5 into scikit-learn-contrib:master May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants