Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Single linkage clustering fails for large datasets #11513

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

Closed
lmcinnes opened this issue Jul 14, 2018 · 2 comments · Fixed by #11514
Closed

Single linkage clustering fails for large datasets #11513

lmcinnes opened this issue Jul 14, 2018 · 2 comments · Fixed by #11514

Comments

@lmcinnes
Copy link
Contributor

Description

Single linkage clustering fails for sufficiently large data arrays. This is due to issues in the scipy single linkage clustering see issue scipy/scipy#9031. Pushing a fix upstream to scipy is complicated due to the way the code is structured and which parts are in pure C++ and inaccessible to cython.

Steps/Code to Reproduce

import numpy as np
import sklearn.cluster

data = np.random.normal(size=(64000,2))
clusterer = sklearn.cluster. AgglomerativeClustering(linkage='single').fit(data)

Expected Results

clusterer is assigned a trained single linkage clustering instance.

Actual Results

On my mac laptop this simply freezes the whole machine. On Linux a MemoryError with no traceback results. If the (lack of) error is not reproducible on your machine simply make data a larger array.

Versions

Darwin-17.6.0-x86_64-i386-64bit
Python 3.5.4 |Continuum Analytics, Inc.| (default, Aug 14 2017, 12:43:10)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
NumPy 1.11.3
SciPy 1.0.0
Scikit-Learn 0.19.1

@amueller
Copy link
Member

wanna link your implementation so we can see how hard it would be to port?
I don't like the way we have more and more custom implementations of basic algorithms but I guess it's worth it here.
Also a benchmark would be cool?

Btw, you should check out https://github.com/amueller/information-theoretic-mst which is always better ;)

@lmcinnes
Copy link
Contributor Author

Thanks for the link. Benchmark is now in the pull request.

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 a pull request may close this issue.

2 participants