- Introduced by
- Danon, Diaz-Guilera, Duch, Arenas
- Year
- 2005
- Type
- Information-theoretic metric
- Family
- External Clustering Validation
What does it do?
Normalized Mutual Information (NMI) is an external clustering evaluation metric based on information theory.
It measures the information a predicted partition shares with a reference partition and scales that quantity by the entropies of the two partitions, giving values between 0 and 1. A value close to 1 indicates strong agreement, and a value of 0 indicates that the two partitions are independent. Mutual information on its own has no upper bound, so the normalization is what makes the score bounded and comparable.
The intuition behind the method
Mutual information measures how much knowing the reference labels reduces uncertainty about the predicted cluster assignments, and the reverse. It equals zero when the two partitions are independent. On its own it has no upper bound and depends on the entropies of the partitions, so its scale changes with the data. Because the mutual information cannot exceed either entropy, dividing by a function of the two entropies gives a score between 0 and 1. Values close to 1 indicate a good match to the reference, and there is no fixed cut-off that separates good from poor agreement. Both partitions must label the same set of items.
History
NMI is a standard external validation measure for clustering and community detection. Danon, Diaz-Guilera, Duch and Arenas (2005) compared community detection methods on networks with known community structure and proposed a standard benchmark for that purpose; the paper is cited here as related background on evaluating community detection. The geometric-mean definition given on this page follows the textbook treatment in Zaki and Meira, Data Mining and Analysis.
When to use it
Use NMI when two partitions cover the same set of items and you want an information-theoretic measure of how much they share, for example when comparing a clustering with reference labels or with another clustering. It can be used when the two partitions have different numbers of clusters, since the formulas do not require them to match. NMI is not corrected for chance agreement and tends to rise as the number of clusters grows, even for unrelated partitions. When you compare clusterings with many clusters or very different numbers of clusters, prefer a chance-adjusted measure such as the adjusted Rand index. Also be cautious when the partitions are strongly unbalanced, because the entropies that set the denominator then carry much of the interpretation.
Limitations and considerations
- Needs a reference partition to compare against. Without one, NMI can only measure agreement between two clusterings, not accuracy of a single clustering.
- Not corrected for chance: it tends to increase with the number of clusters, so comparisons across very different cluster counts can be misleading.
- The mutual information sums over every pair of predicted cluster and reference label, so the computation grows with the number of clusters on both sides.
- Interpreting a value requires understanding entropy, since both the numerator and the denominator depend on the distribution of items across clusters.
- Different normalizations (geometric mean, arithmetic mean) give different numbers for the same partitions, so results from different sources are only comparable when the same form is used.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Grounded in information theory: the numerator is the mutual information, a direct measure of shared information between the two partitions.
- Bounded between 0 and 1 under both normalizations, so values can be compared across comparisons on the same items.
- Symmetric in the two partitions: swapping the predicted clustering and the reference labels leaves both the mutual information and the entropy sum unchanged.
- Does not require the predicted and reference partitions to have the same number of clusters.
Applications
- Community detection evaluation: assessing the accuracy of network community detection algorithms against ground truth communities
- Clustering benchmark assessment: comparing clustering algorithms on standard datasets with known labels
- Semi-supervised learning evaluation: measuring clustering quality when partial ground truth is available
- Multi-view clustering: evaluating agreement between clustering results from different data views or sources
- Robustness testing: assessing how clustering stability across different algorithm runs or parameter settings
How it works
How it works
Calculate the entropy H(C) of the predicted clustering and H(L) of the reference labels. Each entropy measures how spread out the items are across the groups of its partition.
Formula
H(C) = -\sum_i P(c_i) \log P(c_i)
Compute the mutual information I(C, L) by summing, over every pair of predicted cluster and reference label, the joint probability times the log of the joint probability divided by the product of the marginal probabilities. It measures how much the observed joint distribution departs from independence, and it is zero when the partitions are independent. It is never larger than H(C) or H(L).
Formula
I(C, L) = \sum_{i,j} P(c_i, l_j) \log \frac{P(c_i, l_j)}{P(c_i)P(l_j)}A common alternative normalization divides twice the mutual information by the sum of the two entropies. It is symmetric in the two partitions and lies between 0 and 1, but it generally gives different values from the geometric form, so the two should not be mixed.
Formula
NMI = \frac{2 \cdot I(C, L)}{H(C) + H(L)}The standard definition divides the mutual information by the geometric mean of the two entropies, I(C, L) / sqrt(H(C)·H(L)). This equals the geometric mean of the ratios I/H(C) and I/H(L), each of which is at most 1, so the score lies in [0, 1].
Formula
NMI_{geom} = \frac{I(C, L)}{\sqrt{H(C) \cdot H(L)}}Common pitfalls
- Mixing normalization schemes: the geometric and arithmetic forms give different values. Report which form was used.
- Comparing NMI across clusterings with very different numbers of clusters without considering that NMI can be inflated by many clusters.
- Reading NMI on strongly unbalanced partitions as a sign of quality without checking H(C) and H(L). The denominator depends on these entropies, which changes the meaning of the score.
- Treating a given value as good or bad by a fixed threshold. Values near 1 indicate good agreement, but no universal cut-off exists.
Frequently asked questions
What is the difference between arithmetic and geometric normalization of NMI?
Geometric normalization divides the mutual information by the geometric mean of the two entropies, and this is the textbook definition. Arithmetic normalization divides twice the mutual information by the sum of the two entropies. Both lie between 0 and 1 but give different values for the same pair of partitions, so report which form you used and do not compare scores across forms.
When should I use NMI instead of ARI?
NMI is based on information theory and measures shared information between two partitions. The adjusted Rand index is based on counting pairs of items and is adjusted for agreement expected by chance. NMI is not chance-corrected and tends to rise with the number of clusters even for random partitions, so the adjusted Rand index is preferable when cluster counts are large or differ greatly. Use NMI when an information-theoretic interpretation is the goal.
Can NMI be used for comparing two unsupervised clusterings without ground truth?
Yes. NMI measures agreement between any two partitions of the same items, so one clustering can be treated as the predicted partition and the other as the reference. This measures how similar or stable two clustering results are, not whether either one is correct.
Is NMI affected by the number of clusters?
Yes. The entropy of a partition depends on the number of clusters and on how evenly items are spread across them, and both entropies appear in the normalization. NMI is also not corrected for chance and tends to increase with the number of clusters, so values from clusterings with very different numbers of clusters should be compared with care.
Related methods
Sources
Danon, L., Diaz-Guilera, A., Duch, J., & Arenas, A. (2005). Comparing community structure identification. Journal of Statistical Mechanics: Theory and Experiment, 2005(09), P09008.
Open DOI referenceData Mining and Analysis (Zaki & Meira), Normalized Mutual Information, p. 432