Class NormalizedMutualInformation

java.lang.Object
smile.validation.metric.NormalizedMutualInformation
All Implemented Interfaces:
Serializable, ClusteringMetric

public class NormalizedMutualInformation extends Object implements ClusteringMetric
Normalized Mutual Information (NMI) for comparing clustering. Normalized mutual information is between 0 (no mutual information) and 1 (perfect correlation). Normalization has been shown to improve the sensitiveness with respect to the difference in cluster distribution in the two clusterings.

References

  1. X. Vinh, J. Epps, J. Bailey. Information Theoretic Measures for Clusterings Comparison: Variants, Properties, Normalization and Correction for Chance. JMLR, 2010.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • score

      public double score(int[] y1, int[] y2)
      Description copied from interface: ClusteringMetric
      Returns a score to measure the quality of clustering.
      Specified by:
      score in interface ClusteringMetric
      Parameters:
      y1 - the ground truth (or simply a clustering labels).
      y2 - the alternative cluster labels.
      Returns:
      the metric.
    • joint

      public static double joint(int[] y1, int[] y2)
      Calculates the normalized mutual information of I(y1, y2) / H(y1, y2).
      Parameters:
      y1 - the clustering labels.
      y2 - the alternative cluster labels.
      Returns:
      the metric.
    • max

      public static double max(int[] y1, int[] y2)
      Calculates the normalized mutual information of I(y1, y2) / max(H(y1), H(y2)).
      Parameters:
      y1 - the clustering labels.
      y2 - the alternative cluster labels.
      Returns:
      the metric.
    • sum

      public static double sum(int[] y1, int[] y2)
      Calculates the normalized mutual information of 2 * I(y1, y2) / (H(y1) + H(y2)).
      Parameters:
      y1 - the clustering labels.
      y2 - the alternative cluster labels.
      Returns:
      the metric.
    • sqrt

      public static double sqrt(int[] y1, int[] y2)
      Calculates the normalized mutual information of I(y1, y2) / sqrt(H(y1) * H(y2)).
      Parameters:
      y1 - the clustering labels.
      y2 - the alternative cluster labels.
      Returns:
      the metric.
    • min

      public static double min(int[] y1, int[] y2)
      Calculates the normalized mutual information of I(y1, y2) / min(H(y1), H(y2)).
      Parameters:
      y1 - the clustering labels.
      y2 - the alternative cluster labels.
      Returns:
      the metric.
    • toString

      public String toString()
      Overrides:
      toString in class Object