I want to perform agglomerative clustering, but I have no idea of number of clusters before hand. But I want that every cluster has at least 40 data points in it. How can I apply this to sklearn.agglomerative clustering? Should I use dendrogram and cut it somehow? I have no idea how to relate dendrogram to this and cutting it out. Any help will be appreciated!
-
$\begingroup$ There is an awesome explanation here, that you may find useful. It has answers and examples on how to select the cut-off from the dendrogram, and code to implement it in python. joernhees.de/blog/2015/08/26/… $\endgroup$– Sole GDec 6, 2017 at 14:29
-
$\begingroup$ According to our answer guide: "Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there." $\endgroup$– MephyDec 6, 2017 at 21:02
-
$\begingroup$ For a concise guide on input parameters used in various clustering algs, check the scikit-learn overview on clustering methods. $\endgroup$– CubeBot88Jun 25, 2018 at 12:50
2 Answers
A minimum cluster size will not generally be satisfiable in hierarchical clustering. Instead, you have to expect many clusters with just a single point.
ELKI has some fairly interesting techniques to cut a dendrogram. Check the clustering.hierarchical.extraction
(or so) package. If I remember correctly, some allow you to set a minimum size (but there will be a "noise" cluster with all the leftovers).
If you don t know the number of clusters, i encourage you to look at those density based algorithm : Mean Shift, DBSCAN, OPTICS. They don t presume of the cluster number and are able to find random shape clusters.