How to get flat clustering corresponding to color clusters in the dendrogram created by scipy
I think you’re on the right track. Let’s try this: import scipy import scipy.cluster.hierarchy as sch X = scipy.randn(100, 2) # 100 2-dimensional observations d = sch.distance.pdist(X) # vector of (100 choose 2) pairwise distances L = sch.linkage(d, method=’complete’) ind = sch.fcluster(L, 0.5*d.max(), ‘distance’) ind will give you cluster indices for each of the 100 … Read more