Variation of Information Calculator
Inputs
- Inputs: entropy of the first clustering 2.50 bits, entropy of the second 2.20 bits, mutual information between them 1.40 bits.
- Each clustering still has unexplained entropy once the other is known: 2.50 - 1.40 = 1.10 bits one way and 2.20 - 1.40 = 0.80 bits the other.
- Variation of information adds the two conditional entropies: 1.10 + 0.80 = 1.90 bits.
- Equivalently VI = H(X) + H(Y) - 2 x I(X;Y) = 2.50 + 2.20 - 2 x 1.40 = 1.90 bits of disagreement between the two clusterings.
The variation of information measures how much information is lost and gained when moving from one clustering of a dataset to another. Proposed by Marina Meila, it is built from three quantities any clustering comparison can supply - the entropy of each clustering and their mutual information - and it has a rare distinction among clustering measures: it is a true metric, obeying the triangle inequality. Enter the three quantities and the calculator returns VI with the joint entropy and normalised forms.
Where agreement indices ask 'how similar?', VI asks the information-theoretic question: how many bits of uncertainty about one partition remain once the other is known, counted in both directions.
Worked examples
Moderately related partitions
(2.5 bits · 2.2 bits · 1.4 bits)
| Variation of information (bits) | 1.90 |
| Joint entropy H(X,Y) | 3.30 |
| Normalized VI (share of joint entropy) | 0.5758 |
| Shared information (share of joint entropy) | 42.42% |
Near-duplicate clusterings
(3.1 bits · 2.85 bits · 2.3 bits)
| Variation of information (bits) | 1.35 |
| Joint entropy H(X,Y) | 3.65 |
| Normalized VI (share of joint entropy) | 0.3699 |
| Shared information (share of joint entropy) | 63.01% |
Balanced but weakly related
(1.58 bits · 1.58 bits · 0.92 bits)
| Variation of information (bits) | 1.32 |
| Joint entropy H(X,Y) | 2.24 |
| Normalized VI (share of joint entropy) | 0.5893 |
| Shared information (share of joint entropy) | 41.07% |
A metric built from conditional entropy
Knowing clustering Y does not fully determine clustering X. The leftover uncertainty is the conditional entropy H(X|Y); symmetrically, H(Y|X) measures what Y still hides once X is known. The variation of information is their sum - the total information the two partitions fail to share.
In the first worked example the entropies are 2.50 and 2.20 bits and the mutual information is 1.40 bits, so the conditional entropies are 1.10 and 0.80 bits and VI = 1.90 bits. Every bit of VI is a bit of genuine structural disagreement, not a rescaled similarity score.
- All three inputs must use the same logarithm base - bits (base 2) throughout this page.
- Mutual information cannot exceed the smaller of the two entropies; inconsistent inputs produce meaningless output.
- VI = 0 exactly when the two partitions are identical.
The two faces of the formula
The conditional-entropy form and the textbook form are the same arithmetic: H(X) + H(Y) - 2 I(X;Y). The first example gives 2.50 + 2.20 - 2 x 1.40 = 1.90 bits either way. The joint entropy, H(X) + H(Y) - I(X;Y) = 3.30 bits, is the total information in the pair of partitions, and it bounds VI from above.
Dividing VI by that joint entropy gives the normalised value shown in the results: 0.5758 for the first example, meaning the disagreement is well over half of everything there is to know about the pair. The shared-information share is the complement view: mutual information covers 42.42% of the joint entropy.
| Example | H(X) | H(Y) | I(X;Y) | VI |
|---|---|---|---|---|
| First | 2.50 | 2.20 | 1.40 | 1.90 |
| Second | 3.10 | 2.85 | 2.30 | 1.35 |
| Third | 1.58 | 1.58 | 0.92 | 1.32 |
Worked examples
Example 1: Entropy of clustering X 2.5; Entropy of clustering Y 2.2; Mutual information I(X;Y) 1.4. Variation of information (bits) = 1.90. Supporting values: Joint entropy H(X,Y) 3.30; Normalized VI (share of joint entropy) 0.5758; Shared information (share of joint entropy) 42.42%. Inputs: entropy of the first clustering 2.50 bits, entropy of the second 2.20 bits, mutual information between them 1.40 bits. Each clustering still has unexplained entropy once the other is known: 2.50 - 1.40 = 1.10 bits one way and 2.20 - 1.40 = 0.80 bits the other. Variation of information adds the two conditional entropies: 1.10 + 0.80 = 1.90 bits. Equivalently VI = H(X) + H(Y) - 2 x I(X;Y) = 2.50 + 2.20 - 2 x 1.40 = 1.90 bits of disagreement between the two clusterings.
Example 2: Entropy of clustering X 3.1; Entropy of clustering Y 2.85; Mutual information I(X;Y) 2.3. Variation of information (bits) = 1.35. Supporting values: Joint entropy H(X,Y) 3.65; Normalized VI (share of joint entropy) 0.3699; Shared information (share of joint entropy) 63.01%. Inputs: entropy of the first clustering 3.10 bits, entropy of the second 2.85 bits, mutual information between them 2.30 bits. Each clustering still has unexplained entropy once the other is known: 3.10 - 2.30 = 0.80 bits one way and 2.85 - 2.30 = 0.55 bits the other. Variation of information adds the two conditional entropies: 0.80 + 0.55 = 1.35 bits. Equivalently VI = H(X) + H(Y) - 2 x I(X;Y) = 3.10 + 2.85 - 2 x 2.30 = 1.35 bits of disagreement between the two clusterings.
Example 3: Entropy of clustering X 1.58; Entropy of clustering Y 1.58; Mutual information I(X;Y) 0.92. Variation of information (bits) = 1.32. Supporting values: Joint entropy H(X,Y) 2.24; Normalized VI (share of joint entropy) 0.5893; Shared information (share of joint entropy) 41.07%. Inputs: entropy of the first clustering 1.58 bits, entropy of the second 1.58 bits, mutual information between them 0.92 bits. Each clustering still has unexplained entropy once the other is known: 1.58 - 0.92 = 0.66 bits one way and 1.58 - 0.92 = 0.66 bits the other. Variation of information adds the two conditional entropies: 0.66 + 0.66 = 1.32 bits. Equivalently VI = H(X) + H(Y) - 2 x I(X;Y) = 1.58 + 1.58 - 2 x 0.92 = 1.32 bits of disagreement between the two clusterings.
Normalizing by the joint entropy
Raw VI grows with the entropy of the partitions, so a VI of 1.90 bits means something different for two coarse partitions than for two fine ones. Normalising by the joint entropy puts the value on a 0-to-1 scale: the near-duplicate second example scores 0.3699 normalised, while the weakly related third example, despite a similar raw VI of 1.32 bits, scores 0.5893 because its partitions carry less total information to begin with.
Other normalisations exist - by the maximum of the two entropies, or by log of the item count - and they answer slightly different questions. The joint-entropy version used here has the cleanest reading: the share of the pair's total information that is not shared.
VI versus ARI and NMI
The adjusted Rand index counts pairs; normalised mutual information measures shared information as a similarity; VI measures unshared information as a distance. They usually rank competing clusterings the same way, but they diverge in instructive cases: VI penalises a clustering that splits a true cluster more than one that merges two, in proportion to the information destroyed, while pair-counting indices weight the errors by cluster size squared.
VI also decomposes. The two conditional entropies can be reported separately to show which partition is 'explaining' the other - invaluable when comparing a clustering against a reference classification, where H(reference|clustering) and H(clustering|reference) carry different meanings.
Computing the inputs
From a contingency table, each entropy is computed from the cluster proportions: H = -sum p log2 p over clusters. The mutual information sums p_ij log2 (p_ij / (p_i p_j)) over all cells. Standard libraries report all three, and any two of VI, the entropies and the mutual information determine the third.
One caution: entropies estimated from small samples are biased downward, and the bias differs between partitions of different granularity. With few items per cluster, treat small VI differences as noise - the metric is exact, but its inputs are estimates.
One more reading of the secondaries is worth developing, because it turns VI from a score into a diagnosis. The joint entropy of 3.30 bits in the first example is the total information needed to specify both clusterings of an item; the shared 42.42% is the part either clustering gives you about the other, and the normalised VI of 0.5758 is the unshared remainder. When two clusterings disagree, asking whether the disagreement is a large share of a small joint entropy - the third example's profile, 0.5893 of only 2.24 bits - or a smaller share of a large one tells you whether you are looking at fine partitions that nearly agree or coarse ones that genuinely diverge.
VI also satisfies the triangle inequality, which none of the pair-counting indices can promise: the distance from clustering A to clustering C is never more than the distance from A to B plus B to C. That property is what licenses the geometric language of this page - clusterings as points in a space, algorithms as paths through it, and consensus clustering as a search for a centre. A measure you can do geometry with is a different instrument from a score you can only rank by.
There is a final, underused virtue to record: because VI is built from entropies, it decomposes by cluster. The conditional entropy of the reference given the candidate, taken cluster by cluster, shows which reference classes a new clustering splits and which it merges, and the two conditional entropies together explain the single distance of 1.90 bits in the first example as a specific pattern of splits and merges rather than an undifferentiated disagreement. When the question is not 'how far apart are these clusterings' but 'where exactly do they part company', that decomposition is the answer, and it is available from the same three inputs.
FAQs
What variation of information does the first example give?
The first example gives VI = 1.90 bits: entropies of 2.50 and 2.20 bits minus twice the 1.40 bits of mutual information.
What is the joint entropy in the first example?
The joint entropy is 3.30 bits in the first example - the two entropies summed, minus the 1.40 bits counted twice. It is the ceiling that VI is normalised against.
What normalized VI does the first example give?
The normalised VI is 0.5758: the 1.90 bits of disagreement as a share of the 3.30 bits of joint entropy.
What share of the joint entropy is shared information in example one?
Shared information covers 42.42% of the joint entropy in the first example - the 1.40 bits of mutual information over the 3.30-bit total.
What VI does the near-duplicate second example give?
The near-duplicate second example gives VI = 1.35 bits. Its mutual information of 2.30 bits covers 63.01% of the joint entropy, so little disagreement remains.
What share is shared in the second example?
In the second example 63.01% of the joint entropy is shared information - the highest overlap of the three examples, matching its low VI of 1.35 bits.