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

Division by zero with 'precomputed' matrix #19

Closed
ghost opened this issue Dec 16, 2015 · 2 comments
Closed

Division by zero with 'precomputed' matrix #19

ghost opened this issue Dec 16, 2015 · 2 comments
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Dec 16, 2015

Please see the log below:

lbl = hd.HDBSCAN(min_cluster_size=3,metric="precomputed").fit_predict(dst)
File "/usr/local/lib/python2.7/dist-packages/hdbscan/hdbscan_.py", line 549, in fit_predict
self.fit(X)
File "/usr/local/lib/python2.7/dist-packages/hdbscan/hdbscan_.py", line 531, in fit
self.min_spanning_tree) = hdbscan(X, **self.get_params())
File "/usr/local/lib/python2.7/dist-packages/hdbscan/hdbscan
.py", line 379, in hdbscan
return tree_to_labels(X, single_linkage_tree, min_cluster_size) + (result_min_span_tree,)
File "/usr/local/lib/python2.7/dist-packages/hdbscan/hdbscan
.py", line 53, in _tree_to_labels
labels, probabilities = get_clusters(condensed_tree, stability_dict)
File "hdbscan/_hdbscan_tree.pyx", line 466, in hdbscan._hdbscan_tree.get_clusters (hdbscan/_hdbscan_tree.c:9279)
File "hdbscan/_hdbscan_tree.pyx", line 508, in hdbscan._hdbscan_tree.get_clusters (hdbscan/_hdbscan_tree.c:9142)
File "hdbscan/_hdbscan_tree.pyx", line 418, in hdbscan._hdbscan_tree.get_probabilities (hdbscan/_hdbscan_tree.c:7703)
ZeroDivisionError: float division

'dst' is a Numpy array which encodes the distance matrix. I would appreciate if you would comment on this issue.

@lmcinnes lmcinnes added the bug label Dec 16, 2015
@lmcinnes lmcinnes self-assigned this Dec 16, 2015
@lmcinnes
Copy link
Collaborator

Yes, this is a small bug in the soft cluster calculation that can arise is slightly pathological cases (from the point of view of the soft cluster computation -- the clustering could be fairly normal otherwise). Thanks for catching this. I'll try and get a fix written some time today and try and get corresponding releases out some time after that.

@ghost
Copy link
Author

ghost commented Dec 16, 2015

Thank you very much, I look forward to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant