Hierarchical Clustering and "cluster's number" (not number of clusters)

4 views (last 30 days)
I perform a hierarchical clustering:
rng default; % For reproducibility
X = [1 2;2.5 4.5;2 2;4 1.5;...
4 2.5];
Y = pdist(X)
Y = pdist(X)
squareform(Y)
Z = linkage(Y)
A =cluster(Z,'MaxClust',2:3);
The problem is that the cluster's number of the clustering with 2 clusters is not consistent with the clustering with 3 clusters: all cluster's numbers have changed (the same is true with 4 or 5 clusters...) Is there a way to solve this problem or to easily re-index the clusters in a consistent way ?

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!