Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Variation of Information for Comparing Partitions

Cluster Validity and Stability · Tutorial 280 of 700

Variation of Information for Comparing Partitions

Learn to calculate variation of information, interpret it in nats, and understand why it is a metric even when two clusterings have different numbers of groups.

Advanced 12 min read

What You'll Learn

  • Define cluster entropy, joint entropy, conditional entropy, and mutual information for two partitions of the same cells.
  • Derive variation of information as the sum of two conditional entropies.
  • Calculate variation of information from a contingency table, including when cluster counts differ.
  • Interpret zero distance, positive distance, and the units of the result.
  • Verify the metric properties and recognize situations where comparisons are not meaningful.
  • Distinguish variation of information from label matching and pair-count-based agreement measures.

Why Compare Partitions With Information?

Two clustering runs can assign the same cells to different numbers of groups, and cluster labels such as “1” and “2” are arbitrary. A useful comparison should therefore depend on which cells share groups, not on the names assigned to those groups or on having the same number of groups. Variation of information (VI) measures how much information about one partition is missing when the other partition is known.

For a valid comparison, both partitions must classify the same set of cells, with each cell assigned to exactly one cluster in each partition. Unless otherwise stated, each cell receives equal weight, so a cell selected uniformly at random defines the probability distribution used below. This makes the calculation empirical: cluster proportions and joint proportions are counts divided by the number of cells.

Definition: Let \(C\) and \(D\) denote the cluster labels assigned to a uniformly selected cell by two partitions of the same \(n\) cells. The entropy of \(C\) is \(H(C)=-\sum_c P(C=c)\log P(C=c)\); define \(H(D)\) analogously. Their mutual information is \(I(C;D)=\sum_{c,d}P(C=c,D=d)\log\left(\frac{P(C=c,D=d)}{P(C=c)P(D=d)}\right)\). Variation of information is \(VI(C,D)=H(C)+H(D)-2I(C;D)\). Use natural logarithms by default, so VI is measured in nats. Terms with zero probability contribute zero.

The joint probabilities \(P(C=c,D=d)\) are obtained from the contingency table of the two partitions. A row represents a cluster in \(C\), a column a cluster in \(D\), and each entry counts cells assigned to that pair of clusters. Empty combinations have probability zero and do not contribute to the sums. The labels themselves do not matter: permuting rows or columns changes neither the probabilities nor VI.

From Mutual Information to Conditional Entropy

Conditional entropy \(H(C\mid D)\) is the average uncertainty about \(C\) that remains after \(D\) is known. In terms of entropies, \(H(C\mid D)=H(C,D)-H(D)\), where \(H(C,D)\) is the entropy of the joint cluster-pair distribution. Mutual information satisfies \(I(C;D)=H(C)+H(D)-H(C,D)\). Substituting this identity into the definition of VI gives

$$ \begin{aligned} VI(C,D) &=H(C)+H(D)-2I(C;D)\\ &=H(C)+H(D)-2\bigl[H(C)+H(D)-H(C,D)\bigr]\\ &=2H(C,D)-H(C)-H(D)\\ &=H(C\mid D)+H(D\mid C). \end{aligned} $$

This form gives the measure its direct interpretation: one term records the uncertainty about \(C\) left by \(D\), and the other records the uncertainty about \(D\) left by \(C\). Both directions matter. If one clustering splits a group in the other, for example, the extra distinctions are counted even if the reverse comparison would appear less complicated.

Worked Example: A Two-Cluster Comparison

Suppose 10 hypothetical cells are assigned by partition \(C\) and partition \(D\) as follows. The entries are counts.

\(D_1\)\(D_2\)Total
\(C_1\)415
\(C_2\)145
Total5510

Each partition has two equally sized clusters, so \(H(C)=H(D)=-2(0.5\ln 0.5)=\ln 2\approx0.6931\) nats. The joint probabilities are \(0.4, 0.1, 0.1,\) and \(0.4\), giving

$$ H(C,D)=-2(0.4\ln 0.4)-2(0.1\ln 0.1) \approx 1.1935. $$

Therefore \(I(C;D)=H(C)+H(D)-H(C,D)\approx1.3863-1.1935=0.1927\) nats, and \(VI(C,D)=0.6931+0.6931-2(0.1927)\approx1.0008\) nats. The partitions share some structure, but there remains substantial uncertainty about either assignment after the other is known.

Comparing Different Numbers of Clusters

Nothing in the definition requires the partitions to have the same number of clusters. Each partition contributes its own marginal entropy, and the joint table simply has as many rows and columns as its partitions have observed clusters. This is useful when comparing clustering resolutions: VI accounts for disagreement in cell membership and for distinctions introduced or lost when the number of groups changes.

Worked Example: Two Clusters Versus Three

Consider eight hypothetical cells. Partition \(C\) has two clusters, and partition \(D\) has three:

\(D_1\)\(D_2\)\(D_3\)Total
\(C_1\)3104
\(C_2\)0224
Total3328

The two row proportions are both \(1/2\), so \(H(C)=\ln2\approx0.6931\). The column proportions are \(3/8,3/8,2/8\), so \(H(D)=-2(3/8\ln(3/8))-(2/8\ln(2/8))\approx1.0822\) nats.

The four nonzero joint proportions are \(3/8,1/8,2/8,2/8\). Thus \(H(C,D)=-(3/8\ln(3/8))-(1/8\ln(1/8))-2(2/8\ln(2/8))\approx1.3209\) nats. Using the entropy form, \(VI(C,D)=2(1.3209)-0.6931-1.0822\approx0.8664\) nats.

The value is a distance, not a test statistic or a percentage. Its size has no universal “good agreement” threshold: it must be interpreted in relation to the data and the comparisons being made. This example shows how a three-group partition can be compared directly with a two-group partition without matching or discarding a group.

Why VI Is a Distance

VI is nonnegative because each conditional entropy is nonnegative. It is symmetric because \(H(C\mid D)+H(D\mid C)\) is unchanged when \(C\) and \(D\) are swapped. It is zero exactly when each partition determines the other: every cluster in one corresponds to exactly one cluster in the other, up to relabelling. Thus zero means the same grouping of cells, not necessarily the same cluster names.

The triangle inequality also holds. For three partitions \(A,B,C\), conditional entropy cannot increase when additional information is supplied. By the chain rule and this fact, \(H(A\mid C)\leq H(B\mid C)+H(A\mid B)\): first, \(H(A\mid C)\leq H(A,B\mid C)\); then \(H(A,B\mid C)=H(B\mid C)+H(A\mid B,C)\leq H(B\mid C)+H(A\mid B)\). Reversing the roles gives \(H(C\mid A)\leq H(B\mid A)+H(C\mid B)\). Adding the inequalities yields

$$ \begin{aligned} VI(A,C) &=H(A\mid C)+H(C\mid A)\\ &\leq H(A\mid B)+H(B\mid A)+H(B\mid C)+H(C\mid B)\\ &=VI(A,B)+VI(B,C). \end{aligned} $$

The triangle inequality means that VI behaves coherently as a distance across partitions, rather than merely assigning an arbitrary disagreement score. For a fixed set of \(n\) cells, it also satisfies \(0\leq VI(C,D)\leq\ln n\). To see the upper bound, \(VI=2H(C,D)-H(C)-H(D)\leq H(C,D)\), since \(H(C,D)\leq H(C)+H(D)\); and the joint distribution has at most \(n\) observed cell-pairs, so \(H(C,D)\leq\ln n\). The bound depends on the number of cells and the log base.

Worked Example: Different Labels, Identical Partition

Suppose four hypothetical cells have \(C\)-labels \((a,a,b,b)\), while \(D\)-labels are \((2,2,1,1)\). The labels differ, but the group memberships are identical. After ordering rows and columns by their observed memberships, the contingency table has counts 2 and 2 on its diagonal and zero elsewhere.

Each partition has entropy \(\ln2\), and the joint entropy is also \(\ln2\), because each cluster in one partition identifies the corresponding cluster in the other. Hence \(VI(C,D)=2\ln2-2\ln2=0\) nats. Treating the label names as meaningful categories would wrongly suggest disagreement; VI compares partitions, not their arbitrary names.

Diagnostics, Alternatives, and Limitations

Before interpreting a value, check that the partitions refer to exactly the same cells and that the contingency-table margins agree with the stated cluster sizes. A row or column of all zeros is not an observed cluster and should be omitted. Confirm that probabilities sum to one and that the same logarithm base is used throughout. A calculation producing negative VI indicates an error in the table, probabilities, or arithmetic.

VI differs from label matching and pair-count-based measures. Relabelling clusters is unnecessary, and unequal cluster counts pose no special problem. Measures such as the adjusted Rand index instead summarize agreement among pairs of cells and adjust for chance agreement under a specified model; they answer a related but not identical question and have a different scale. VI is interpretable through uncertainty and has units that depend on the logarithm base. Changing from natural logarithms to base-2 logarithms multiplies every value by \(1/\ln2\), expressing the distance in bits instead of nats.

A common mistake is to interpret a larger VI as a fixed amount of biological instability, or to compare values across datasets without considering their size and composition. VI describes disagreement between two observed partitions; it does not establish which partition is biologically correct, and it does not identify the source of disagreement. Comparisons are most informative when the same cells, preprocessing choices, and weighting convention are used. If runs contain different cells, a direct contingency table is not defined until the comparison set is specified; comparing only shared cells changes the target population and should be reported as such.

Key takeaway: \(VI(C,D)=H(C\mid D)+H(D\mid C)\). It is zero for identical groupings up to labels, positive when assignments differ, and valid when the partitions have different numbers of clusters. State the cell set, log base, and units when reporting it.

Check Your Understanding

Answer the questions, then check the solutions below.

  1. What must be shared by two partitions before their VI can be calculated as a direct comparison?
  2. If \(H(C)=0.8\), \(H(D)=1.0\), and \(I(C;D)=0.5\) nats, calculate VI.
  3. What does VI equal to zero say about two partitions? Does it require identical cluster labels?
  4. Why can VI compare a two-cluster partition with a four-cluster partition?
  5. Suppose a calculation gives negative VI. Name one check that should be made.

Solutions. (1) They must assign the same cells, with one cluster assignment per cell in each partition, under the stated weighting convention. (2) \(VI=0.8+1.0-2(0.5)=0.8\) nats. (3) The partitions induce the same grouping, up to relabelling; the labels need not match. (4) The contingency table can have different numbers of rows and columns, and the entropy formula uses each partition’s own margins. (5) Check that the joint probabilities are nonnegative and sum to one, and verify the entropy and mutual-information arithmetic; VI cannot be negative.

Clinical Biostats