You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CalculateInversePurity.m 433B

12345678910111213141516
  1. function score = CalculateInversePurity(true_clustering, test_clustering)
  2. score = 0;
  3. num_clusters = max(true_clustering);
  4. for i = 1 : num_clusters
  5. clusters_for_current_label = test_clustering(true_clustering == i);
  6. majority = mode(clusters_for_current_label);
  7. n = size(true_clustering, 1);
  8. union_size = sum(clusters_for_current_label == majority);
  9. score = score + union_size * 1 / n;
  10. end