12345678910111213141516 |
- function score = CalculateInversePurity(true_clustering, test_clustering)
-
- score = 0;
- num_clusters = max(true_clustering);
-
- for i = 1 : num_clusters
-
- clusters_for_current_label = test_clustering(true_clustering == i);
- majority = mode(clusters_for_current_label);
-
- n = size(true_clustering, 1);
- union_size = sum(clusters_for_current_label == majority);
-
- score = score + union_size * 1 / n;
-
- end
|