# Error when evaluating clusters of a dataset

4 views (last 30 days)
Alberto on 28 Apr 2015
Edited: Alberto on 29 Apr 2015
I'm trying to evaluate the number of a dataset, data is described bellow and clust are the results of a clustering algorithm (vector of classes):
eva=evalclusters(data,clust,'CalinskiHarabasz');
Depending on the data input I'm receiving almost all time the error:
Error using clustering.evaluation.ClusterCriterion (line 447)
The number of clusters to be evaluated must be different for different clustering solutions.
How can I solve the error? Columns are properties and rows are observations in the data array. Error seems to be in the clust array:
1 2 3 3 4 5 6 7 9 8
1 2 3 4 5 6 7 8 7 10
1 1 2 2 2 3 3 4 3 5
1 1 2 2 2 3 3 4 3 5
1 1 2 2 3 4 4 5 5 6
1 1 2 2 2 3 3 4 4 4
1 1 1 1 1 2 2 2 1 1
1 1 2 2 2 3 3 4 3 5
1 2 3 3 4 5 6 7 9 8
1 1 2 2 2 3 3 4 4 4
1 2 3 4 5 6 7 8 7 10
1 1 2 2 3 4 4 5 5 6
1 2 3 3 4 5 5 6 9 7
1 2 3 4 5 6 7 8 8 9
1 1 1 1 1 2 2 2 2 1
1 1 2 2 3 4 4 5 5 6
1 2 3 3 4 5 5 6 9 7
1 1 1 1 1 1 1 1 2 2
1 2 3 4 5 6 7 8 8 9
1 1 2 2 3 4 4 5 5 6
1 1 1 1 1 1 1 1 2 2
1 2 3 4 5 6 7 8 8 9
1 1 2 2 3 4 4 5 5 6
1 1 1 1 1 1 1 3 2 3
1 2 3 3 4 5 5 6 9 7
Thank you.

Tom Lane on 28 Apr 2015
It looks like your next-to-last column, which has cluster numbers up to 9, is missing cluster 6 so it only has 8 clusters. I believe the evalclusters function wants to help choose the number of clusters, and it's not prepared to deal with two different clustering solutions both with 8 clusters.
##### 1 CommentShowHide None
Alberto on 29 Apr 2015
It worked!, Thank you

### Community Treasure Hunt

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

Start Hunting!