hdbscan.prediction.all_points_membership_vectors datatype error

Created on 22 Aug 2018  Â·  2Comments  Â·  Source: scikit-learn-contrib/hdbscan

Hi I have run the following code for one of my project:

ms = 14
mc = 10
clusterer = hdbscan.HDBSCAN(min_samples = ms, min_cluster_size=mc,prediction_data=True).fit(X)
X_memberships = hdbscan.prediction.all_points_membership_vectors(clusterer)

And got the following error message:

/.local/lib/python2.7/site-packages/hdbscan/prediction.pyc in all_points_membership_vectors(clusterer)
534 all_points,
535 clusterer.prediction_data_.exemplars,
--> 536 clusterer.prediction_data_.dist_metric)
537 outlier_vecs = all_points_outlier_membership_vector(
538 clusters,

hdbscan/_prediction_utils.pyx in hdbscan._prediction_utils.all_points_dist_membership_vector()

ValueError: Buffer dtype mismatch, expected 'float64_t' but got 'float'

Most helpful comment

Thanks for tracking this down. I'll see if I can get a proper fix in place
soon.

On Sun, Sep 2, 2018 at 1:28 PM Colin Van Oort notifications@github.com
wrote:

I also encountered this error.
It seems to work properly if the data is explicitly cast to the
numpy.float64 type, i.e.

clusterer = hdbscan.HDBSCAN().fit(X.astype(numpy.float64))

The error comes from type checking in the Cython function indicated in the
error trace, hdbscan._prediction_utils.all_points_dist_membership_vector
https://github.com/scikit-learn-contrib/hdbscan/blob/80dd6d21830b9e2f703eb3862b28fd2f5b67476b/hdbscan/_prediction_utils.pyx#L98,
where the first argument expects a numpy.float64 type.
Working backwards through the error trace:

HDBSCAN._raw_data is validated by sklearn.utils.check_array
http://scikit-learn.org/stable/modules/generated/sklearn.utils.check_array.html
on line 833 of hdbscan.hdbscan_
https://github.com/scikit-learn-contrib/hdbscan/blob/80dd6d21830b9e2f703eb3862b28fd2f5b67476b/hdbscan/hdbscan_.py#L833,
so it seems like the issue here may be that check_array is not performing a
strict enough type validation.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/scikit-learn-contrib/hdbscan/issues/231#issuecomment-417946161,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALaKBQ3vxZkkZT07aZR6lwffZ7NSXwJdks5uXBUsgaJpZM4WIMgp
.

All 2 comments

I also encountered this error.
It seems to work properly if the data is explicitly cast to the numpy.float64 type, i.e.

clusterer = hdbscan.HDBSCAN().fit(X.astype(numpy.float64))

The error comes from type checking in the Cython function indicated in the error trace, hdbscan._prediction_utils.all_points_dist_membership_vector, where the first argument expects a numpy.float64 type.
Working backwards through the error trace:

HDBSCAN._raw_data is validated by sklearn.utils.check_array on line 833 of hdbscan.hdbscan_, so it seems like the issue here may be that check_array is not performing a strict enough type validation.

Thanks for tracking this down. I'll see if I can get a proper fix in place
soon.

On Sun, Sep 2, 2018 at 1:28 PM Colin Van Oort notifications@github.com
wrote:

I also encountered this error.
It seems to work properly if the data is explicitly cast to the
numpy.float64 type, i.e.

clusterer = hdbscan.HDBSCAN().fit(X.astype(numpy.float64))

The error comes from type checking in the Cython function indicated in the
error trace, hdbscan._prediction_utils.all_points_dist_membership_vector
https://github.com/scikit-learn-contrib/hdbscan/blob/80dd6d21830b9e2f703eb3862b28fd2f5b67476b/hdbscan/_prediction_utils.pyx#L98,
where the first argument expects a numpy.float64 type.
Working backwards through the error trace:

HDBSCAN._raw_data is validated by sklearn.utils.check_array
http://scikit-learn.org/stable/modules/generated/sklearn.utils.check_array.html
on line 833 of hdbscan.hdbscan_
https://github.com/scikit-learn-contrib/hdbscan/blob/80dd6d21830b9e2f703eb3862b28fd2f5b67476b/hdbscan/hdbscan_.py#L833,
so it seems like the issue here may be that check_array is not performing a
strict enough type validation.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/scikit-learn-contrib/hdbscan/issues/231#issuecomment-417946161,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALaKBQ3vxZkkZT07aZR6lwffZ7NSXwJdks5uXBUsgaJpZM4WIMgp
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kevin-balkoski-enview picture kevin-balkoski-enview  Â·  5Comments

chaturv3di picture chaturv3di  Â·  11Comments

eyaler picture eyaler  Â·  12Comments

learningbymodeling picture learningbymodeling  Â·  8Comments

Berowne picture Berowne  Â·  3Comments