Adjusted mutual information
In probability theory and information theory, adjusted mutual information, a variation of mutual information may be used for comparing clusterings. It corrects the effect of agreement solely due to chance between clusterings, similar to the way the adjusted rand index corrects the Rand index. It is closely related to variation of information: when a similar adjustment is made to the VI index, it becomes equivalent to the AMI. The adjusted measure however is no longer metrical. Mutual information of two partitions. Given a set "S" of "N" elements formula_1, consider two partitions of "S", namely formula_2 with  R clusters, and formula_3 with "C" clusters. It is presumed here that the partitions are so-called "hard clusters;" the partitions are pairwise disjoint: for all formula_5, and complete: The mutual information of cluster overlap between "U" and "V" can be summarized in the form of an "R"x"C" contingency table formula_7, where formula_8 denotes the number of objects that are common to clusters formula_9 and formula_10. That is, Suppose an object is picked at random from "S"; the probability that the object falls into cluster formula_9 is: The entropy associated with the partitioning "U" is: "H(U)" is non-negative and  takes the value 0 only when there is no uncertainty determining an object's cluster membership, "i.e.", when there is only one cluster. Similarly, the entropy of the clustering "V" can be calculated as: where formula_16. The mutual information (MI) between two partitions: where formula_18 denotes the probability that a point belongs to both the cluster formula_9 in "U" and cluster formula_10 in "V": MI is a non-negative quantity upper bounded by the entropies "H"("U") and "H"("V"). It quantifies the information shared by the two clusterings and thus can be employed as a clustering similarity measure. Adjustment for chance . Like the Rand index, the baseline value of mutual information between two random clusterings does not take on a constant value, and tends to be larger when the two partitions have a larger number of clusters (with a fixed number of set elements "N"). By adopting a hypergeometric model of randomness, it can be shown that the expected mutual information between two random clusterings is: where formula_23 denotes formula_24. The variables formula_25 and formula_26 are partial sums of the contingency table; that is, and The adjusted measure for the mutual information may then be defined to be: The AMI takes  a value of 1 when the two partitions are identical and 0 when the MI between two partitions equals the value expected due to chance alone.