Tutorials › Statistical Methods for Single-Cell RNA Sequencing › What Cluster Validity Means in Single-Cell Data

Cluster Validity and Stability · Tutorial 263 of 700

What Cluster Validity Means in Single-Cell Data

Distinguish three kinds of cluster validity, calculate simple examples of each, and judge what their results can and cannot establish about single-cell structure.

Advanced 10 min read

What You'll Learn

  • Define internal validity, external agreement, and perturbation stability for a cell partition.
  • Calculate a simple within-cluster sum of squares and explain what it measures.
  • Assess agreement with reference labels while accounting for label matching and imperfect annotations.
  • Calculate co-clustering retention under a perturbation and interpret its denominator.
  • Diagnose ways that data representation, reference labels, and perturbation choices can mislead.
  • Explain why evidence of computational validity is not by itself evidence of biological reality.

What Does It Mean for a Cluster to Be Valid?

A clustering algorithm always returns groups when asked to do so, but a returned partition is not automatically a meaningful discovery. In single-cell RNA sequencing, cells are grouped using a representation of their measured expression, often after choices about normalization, feature selection, dimensionality reduction, and graph construction. The central question of cluster validity is therefore not simply whether an algorithm produced a result. It is what evidence supports that result, relative to what target, and under what assumptions?

Three forms of evidence are especially useful to distinguish. Internal validity asks whether the clusters fit some structure in the data used to construct them. External agreement asks whether the partition corresponds to labels or measurements not used to create it. Perturbation stability asks whether similar clusters recur after specified changes to the analysis or data. Each addresses a different concern. A compact partition can disagree with known labels; a partition can match labels yet be sensitive to small changes; a stable partition can consistently reflect a technical artifact.

Definition: Let \(n\) cells be assigned to a partition \(C=\{C_1,\ldots,C_K\}\), where each cell belongs to one of \(K\) nonempty clusters. Internal validity evaluates the partition using the data representation or structure used for clustering. External agreement compares it with a separate reference. Perturbation stability evaluates how much the partition, or specified features of it, changes under a defined perturbation. These are distinct properties, not interchangeable scores.

A validity claim is meaningful only after specifying the object being evaluated. The same cells can have different partitions at different resolutions, and the same partition can look different in different representations. A result about Euclidean distances in a selected low-dimensional embedding is not automatically a result about all expression measurements, cell types, or biological mechanisms.

Internal Fit: Structure Relative to the Input

An internal criterion summarizes how well a partition fits a chosen data representation. For example, for points \(y_i\) represented in a Euclidean space, within-cluster sum of squares is

$$ W(C)=\sum_{k=1}^{K}\sum_{i\in C_k}\lVert y_i-\bar{y}_k\rVert^2, \qquad \bar{y}_k=\frac{1}{|C_k|}\sum_{i\in C_k}y_i. $$

Here \(\bar{y}_k\) is the mean vector in cluster \(k\), and the squared distance measures how far each point is from that cluster's mean. Smaller values indicate more compact clusters in this particular representation. This interpretation assumes that Euclidean distance is meaningful for the chosen features, that their scaling is appropriate, and that a mean is a useful cluster summary. Those assumptions may not hold for every embedding or data type.

An internal criterion is not an independent check on the data used to define it. If a clustering procedure explicitly optimizes compactness, then finding a compact result partly confirms that it optimized its objective. It does not show that the grouping corresponds to cell identity. Nor can raw compactness alone compare partitions with different numbers of clusters fairly: splitting clusters generally reduces within-cluster sum of squares.

Worked Example: Compactness Depends on the Partition

Suppose four hypothetical cells have one-dimensional coordinates \(0,1,5,6\) in a representation where Euclidean distance is considered meaningful. Compare the partition \(C_A=\{0,1\}, C_B=\{5,6\}\) with the alternative \(D_A=\{0,5\}, D_B=\{1,6\}\). Calculate within-cluster sum of squares for both.

For the first partition, the cluster means are \(\bar y_A=(0+1)/2=0.5\) and \(\bar y_B=(5+6)/2=5.5\). Therefore,

$$ W(C)=(0-0.5)^2+(1-0.5)^2+(5-5.5)^2+(6-5.5)^2 =0.25+0.25+0.25+0.25=1. $$

For the alternative, both cluster means are \((0+5)/2=2.5\) and \((1+6)/2=3.5\). Thus,

$$ W(D)=(0-2.5)^2+(5-2.5)^2+(1-3.5)^2+(6-3.5)^2 =6.25+6.25+6.25+6.25=25. $$

In this representation, the first partition is much more compact. That is evidence of geometric separation for these four points, not evidence that the groups are distinct biological cell types. The calculation also assumes the coordinates and Euclidean scale are appropriate; changing the representation can change the comparison.

Why Splitting Can Improve an Internal Score

The tendency of within-cluster sum of squares to decrease as clusters are split follows from a decomposition of squared deviations. Suppose a cluster \(C\) is split into nonempty subsets \(G_1,\ldots,G_m\), with sizes \(n_g\), means \(\bar y_g\), and overall mean \(\bar y\). For scalar observations, expand each deviation as \(y_i-\bar y=(y_i-\bar y_g)+(\bar y_g-\bar y)\) for \(i\in G_g\). The cross-product sums to zero because \(\sum_{i\in G_g}(y_i-\bar y_g)=0\). Hence

$$ \sum_{i\in C}(y_i-\bar y)^2 = \sum_{g=1}^{m}\sum_{i\in G_g}(y_i-\bar y_g)^2 + \sum_{g=1}^{m}n_g(\bar y_g-\bar y)^2. $$

The last term is nonnegative, so the sum of squared deviations after splitting is no greater than before. The same identity holds for vectors with squared Euclidean norms. This justifies why a lower compactness score cannot, by itself, establish that a finer partition is preferable: the score can improve simply because the partition has more groups.

For graph-based clustering, an internal assessment can instead examine the graph structure or the objective used to construct communities. The same caution applies: a partition that scores well on its construction objective fits that objective, but an optimized graph criterion is not an external biological validation. Diagnostics should also ask whether clusters are driven by a few highly connected cells, technical effects, or an uneven-density boundary.

External Agreement: Comparison With a Reference

External agreement compares a clustering with a reference variable that was not used to create it—for example, a set of independently assigned cell annotations or a measured experimental label. The reference must be relevant to the question. It may be incomplete, uncertain, measured at a different level of detail, or reflect a different biological concept from the clustering target.

Cluster identifiers themselves are arbitrary: exchanging the names “cluster 1” and “cluster 2” changes no partition. A label-based comparison must therefore account for how cluster names are matched to reference categories. A simple descriptive approach is to assign each cluster its most frequent reference category and report the fraction of cells whose labels agree with that assignment. This summary is easy to interpret, but it can hide minority populations and depends on the particular reference labels.

Worked Example: Agreement With Imperfect Reference Labels

In a hypothetical set of 10 cells, an independently recorded reference has six cells labeled A and four labeled B. A clustering assigns five A-reference cells and one B-reference cell to cluster 1; it assigns one A-reference cell and three B-reference cells to cluster 2. Calculate majority-label agreement.

Cluster 1's majority reference label is A, with five of its six cells. Cluster 2's majority label is B, with three of its four cells. Matching each cluster to its majority label gives \(5+3=8\) matching cells out of 10:

$$ \text{majority-label agreement}=\frac{8}{10}=0.80=80\%. $$

This says that 80% of these cells agree with the cluster-specific majority mapping. It does not mean that there is an 80% probability the clusters are biologically correct. In particular, two cells disagree with their cluster's majority label, and the reference itself may be uncertain or too coarse to distinguish the structures of interest. Agreement is most informative when the reference was measured independently and its meaning and limitations are stated.

Perturbation Stability: Reproducibility Under Defined Changes

Stability concerns whether a clustering feature persists when a specified part of the analysis changes. A perturbation might alter the sampled cells, the selected features, preprocessing choices, or algorithmic randomness. Each perturbation asks a different question. Repeating only a random seed tests sensitivity to that source of randomness; it does not test sensitivity to the data representation or cell sampling.

One simple way to compare runs is to focus on pairs of cells. A pair is co-clustered if its two cells belong to the same cluster. Given a baseline partition and a perturbed run on the same cells, the co-clustering retention fraction is the number of baseline co-clustered pairs that remain co-clustered in the perturbed run divided by the number of co-clustered pairs in the baseline. It ranges from 0 to 1 when the baseline contains at least one co-clustered pair. This one-directional fraction measures retention, not every possible aspect of similarity between partitions.

Worked Example: Retaining Co-Clustered Pairs

Consider eight hypothetical cells. In the baseline, cluster A contains cells 1–4 and cluster B contains cells 5–8. In a perturbed run, one cluster contains cells 1, 2, 3, and 5; the other contains cells 4, 6, 7, and 8. Calculate the baseline co-clustered pairs retained in the perturbed run.

Each baseline cluster contains \(\binom{4}{2}=4(3)/2=6\) co-clustered pairs. Thus the two baseline clusters contain \(2\binom{4}{2}=12\) such pairs in total. Among cells 1–4, the pairs (1,2), (1,3), and (2,3) remain together, so three of the six A-pairs are retained. Among cells 5–8, the pairs (6,7), (6,8), and (7,8) remain together, so three of the six B-pairs are retained. The total retained is \(3+3=6\), giving

$$ \text{retention fraction}=\frac{6}{12}=0.5=50\%. $$

The denominator is the 12 pairs co-clustered in the baseline, not 12 pairs per cluster. This result means that half of the baseline co-clustered pairs remain together in this perturbed run. It does not summarize pairs that were separated in the baseline but newly grouped, and therefore is not a complete measure of agreement between the two partitions.

Interpreting and Comparing the Three Forms of Evidence

Evidence typeMain questionWhat it cannot establish alone
Internal validityDoes the partition fit a selected geometry, graph, or other input structure?That the structure corresponds to a biological category rather than a property of the chosen representation.
External agreementDoes the partition correspond to an independent reference or annotation?That the reference is complete, correct, or aligned with the biological question.
Perturbation stabilityDoes the partition or a specified feature persist under a stated change?That a stable pattern is biologically meaningful rather than a stable artifact.

The three approaches are complementary, not substitutes. Internal criteria are useful for detecting poor fit to the structure being analyzed, but can favor overly fine partitions. External comparison supplies a distinct reference point, but inherits the limitations of the reference. Stability tests robustness to chosen perturbations, but a result is only as informative as those perturbations: a clustering can be highly stable under repeated runs that all use the same flawed features.

A cautious assessment states the target and assumptions for each check. For internal fit, name the representation and distance or graph structure. For external agreement, describe the source and granularity of the reference. For stability, specify what changed, what was held fixed, and which aspect of the partition was compared. Different answers to these questions are not necessarily contradictory; they may reveal that the partition captures one kind of structure but not another.

Diagnostics, Failure Modes, and Biological Interpretation

Warning signs include a favorable internal score that improves mainly as the number of clusters increases; high reference agreement driven by a dominant category while smaller groups are poorly represented; or apparent stability assessed only by rerunning the same settings. Inspect the cluster sizes, the representation and features that drive separation, and the cells near boundaries. Check whether conclusions change when reasonable analytical choices are varied. A diagnostic flags a potential problem; it does not by itself identify the cause.

A common mistake is to conclude, “The clusters are stable and compact, so they are real cell types.” The reasoning treats two computational properties as proof of biological identity. The correction is to state the narrower evidence: “The partition is compact in this representation and persists under these specified perturbations.” Biological interpretation requires relevant supporting evidence beyond those properties, and cluster labels should not be presented as causal explanations of expression patterns.

No single validity number settles the question. Clustering is a representation-dependent summary of variation among cells; biological categories may be continuous, overlapping, or dependent on context. A partition can still be useful without revealing discrete natural kinds. The appropriate conclusion is proportional to the evidence: describe what was evaluated, what remained consistent, what did not, and which biological claims remain unsupported.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. A partition has lower within-cluster sum of squares after one cluster is split in two. Does that alone show the split is biologically justified?
  2. A clustering agrees with an annotation on 45 of 50 cells after matching each cluster to its majority annotation. What is the agreement percentage, and what does it mean?
  3. A baseline partition has clusters of sizes 3 and 5. How many baseline co-clustered pairs are there in total?
  4. A clustering is unchanged across 20 random seeds, but all runs use identical cells and preprocessing. What kind of stability evidence is this, and what has not been tested?

Solutions. 1. No. Splitting cannot increase within-cluster sum of squares, so the decrease may follow from adding a cluster rather than biological validity. 2. \(45/50=0.90\), or 90%. This is the fraction matching the majority-label mapping for that reference in these cells; it does not prove biological correctness. 3. The total is \(\binom{3}{2}+\binom{5}{2}=3+10=13\) pairs. 4. It is evidence of stability to random-seed changes under the fixed analysis. It does not test sensitivity to cell sampling, features, preprocessing, or other choices.

Clinical Biostats