cut a dendrogramm at a specific height to generate clusters
Afficher commentaires plus anciens
Hello, I am trying to group some columns of a complex-valued matrix with the hierarchical clustering method. I created the dissimilarity matrix "dissim" and extract the distance vector from this. I am then generating the linkage matrix and feeding it to the dendrogram function, where I used the example from the mathworks help center to find the (in this example very obvious) 4 groups of entries. The dendrogram looks fine, but as soon as I am applying the cluster() function to the linkage, I am getting rubbish output:
distvec = distancevector(dissim);
tree = linkage(distvec, 'average');
cutoff = 0.5;
CL = cluster(tree, 'Cutoff', cutoff, 'Criterion', 'inconsistent');
dendrogram(tree,'ColorThreshold',cutoff);
The colored dendrogram looks like this, which shows the groups exactly as I want it:

So, the output I would be expecting from the cluster function would be something like this:CL =
CL =
2
2
3
3
1
4
2
1
4
1
4
4
2
1
3
3
i.e, 4 data entries are matched to each of the four clusters. However, CL is put out like that:
CL =
5
8
12
7
4
2
11
9
10
9
3
10
11
1
6
12
I think the dendrogram() function has a different understanding of the cutoff that the cluster() function. How can I fix it so that the clustering works as I want it to?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Hierarchical Clustering dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!