Error when evaluating clusters of a dataset

4 views (last 30 days)
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.

Accepted Answer

Tom Lane
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.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!