In probability theory and information theory, adjusted mutual information, a variation of mutual information may be used for comparing clusterings.[1] 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:[2] when a similar adjustment is made to the VI index, it becomes equivalent to the AMI.[1] The adjusted measure however is no longer metrical.[3]
Mutual information of two partitions
Given a set S of N elements
, consider two partitions of S, namely
with R clusters, and
with C clusters. It is presumed here that the partitions are so-called hard clusters; the partitions are pairwise disjoint:
![{\displaystyle U_{i}\cap U_{j}=\varnothing =V_{i}\cap V_{j))](https://wikimedia.org/api/rest_v1/media/math/render/svg/ab071b0e0fb68d178b2885327a22f0a456075b8d)
for all
, and complete:
![{\displaystyle \cup _{i=1}^{R}U_{i}=\cup _{j=1}^{C}V_{j}=S}](https://wikimedia.org/api/rest_v1/media/math/render/svg/4a5f44dbf8d91881dde6d5f3c2267f75e8dc73ef)
The mutual information of cluster overlap between U and V can be summarized in the form of an RxC contingency table
, where
denotes the number of objects that are common to clusters
and
. That is,
![{\displaystyle n_{ij}=\left|U_{i}\cap V_{j}\right|}](https://wikimedia.org/api/rest_v1/media/math/render/svg/d9fbff426bc0dfc7f7339725b2c1b520a8dc788a)
Suppose an object is picked at random from S; the probability that the object falls into cluster
is:
![{\displaystyle P_{U}(i)={\frac {|U_{i}|}{N))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/e3068589dba2c9d272deb5658271eeb5bd41c568)
The entropy associated with the partitioning U is:
![{\displaystyle H(U)=-\sum _{i=1}^{R}P_{U}(i)\log P_{U}(i)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/b5e45e5ce135c19ccee7ae6c6eabb76ea8cd8224)
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:
![{\displaystyle H(V)=-\sum _{j=1}^{C}P_{V}(j)\log P_{V}(j)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/70a51a95d09e34ce2da84030c03d1bec997313d9)
where
. The mutual information (MI) between two partitions:
![{\displaystyle MI(U,V)=\sum _{i=1}^{R}\sum _{j=1}^{C}P_{UV}(i,j)\log {\frac {P_{UV}(i,j)}{P_{U}(i)P_{V}(j)))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/902525dc3f24d85c8ea21c6a8b26efecd1ce81bf)
where
denotes the probability that a point belongs to both the cluster
in U and cluster
in V:
![{\displaystyle P_{UV}(i,j)={\frac {|U_{i}\cap V_{j}|}{N))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/2041decb19d056002c91bec44822ec93a6ec75d6)
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:
![{\displaystyle {\begin{aligned}E\{MI(U,V)\}=&\sum _{i=1}^{R}\sum _{j=1}^{C}\sum _{n_{ij}=(a_{i}+b_{j}-N)^{+))^{\min(a_{i},b_{j})}{\frac {n_{ij)){N))\log \left({\frac {N\cdot n_{ij)){a_{i}b_{j))}\right)\times \\&{\frac {a_{i}!b_{j}!(N-a_{i})!(N-b_{j})!}{N!n_{ij}!(a_{i}-n_{ij})!(b_{j}-n_{ij})!(N-a_{i}-b_{j}+n_{ij})!))\\\end{aligned))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/1bb502a978a8c40bfbe91e4e4e199ead07aca734)
where
denotes
. The variables
and
are partial sums of the contingency table; that is,
![{\displaystyle a_{i}=\sum _{j=1}^{C}n_{ij))](https://wikimedia.org/api/rest_v1/media/math/render/svg/078ce19070229ba385a231a62adaa91204069fa8)
and
![{\displaystyle b_{j}=\sum _{i=1}^{R}n_{ij))](https://wikimedia.org/api/rest_v1/media/math/render/svg/aaea65436e7ee8ff4d8ea049a66a59d0ca1f0897)
The adjusted measure[1] 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.