Unsupervised learning
Stability, Consensus, and Reproducibility
Compare partitions across seeds, samples, features, and algorithms, then build consensus while preserving uncertainty.
By the end you can
- Design seed, resampling, feature, and preprocessing perturbations for clustering stability
- Align partitions using label-invariant agreement measures
- Explain consensus clustering and co-association matrices
- Distinguish stable structure from coarse, biased, or operationally irrelevant structure
The stable cluster that represented a stable data error
A device cluster survives every random seed and bootstrap sample, and investigation reveals that all members came from one firmware version with a persistent logging offset. Stability confirms that the pattern repeats under tested perturbations. It does not determine whether the pattern reflects the intended phenomenon, a confounder, or a measurement defect.
That gap is not hypothetical. This lesson works through three published versions of it. A cluster-quality index driven to its maximum on data that contained no clusters. Five validated commercial tests disagreeing about 60.6% of the same 302 tumours. A 26-cell population that one of six replicates missed entirely, while it carried more than half the signal of the gene that defines the disease.
Persistence is evidence about reproducibility, not a verdict about meaning.
Case
The subsampling test that also detects the absence of structure
The standard stability test does not start from the clustering. It starts from the data. Subsample it, cluster each subsample, and compare the partitions that come back from each run. Ben-Hur and colleagues set the procedure out in 2002: their method “exploits measurements of the stability of clustering solutions obtained by perturbing the data set”, and “High pairwise similarities indicate a stable clustering pattern.”
Two properties make it the reference procedure rather than one option among many. It “can be used with any clustering algorithm”, so the test is not tied to the objective it is auditing. And it “can also detect the lack of structure in data”. That is the harder half of the job, and the half most stability reports quietly drop.
Example
What stability experiments can reveal
Different perturbations diagnose different failure modes.
- Seed test: Inertia remains similar while one medium cluster exchanges many members with its neighbor.
- Bootstrap test: A small cluster disappears whenever several influential points are omitted, showing weak support — the ionocyte case below is the published form of this, a real cell type absent from one of six biological replicates.
- Feature-block test: Removing geography changes all segments, revealing that location dominates the partition.
- Algorithm test: In OPTIMA prelim, three subtype callers each put 59.5–62.4% of the same tumours in luminal A and still gave different subtypes to 123 of them (40.7%) — agreement in aggregate, disagreement patient by patient.
- Temporal test: A cluster remains geometrically coherent but shrinks after a policy change, indicating lifecycle drift.
Key idea
Consensus can average away rare structure
A co-association matrix records how often pairs appear together across runs, and consensus clustering can convert that matrix into a more stable partition. If most runs overlook a rare group, consensus will often reinforce the majority error, so weight runs, stratify perturbations, and inspect low-frequency but consequential alternatives before averaging them away.
The cost of averaging one away is measurable. In 2018 a cluster of 26 cells turned out to be a cell type nobody had described: the pulmonary ionocyte. It came out of 7,193 mouse tracheal epithelial cells clustered by droplet scRNA-seq and published in Nature. Montoro and colleagues put its weight in one sentence: “Ionocytes comprise only 0.42% of the mouse cells profiled by scRNA-seq, yet express 54.4% of all detected Cftr transcripts.” The far more abundant ciliated cells carried 1.5% of those transcripts. One of the six biological replicates, WT mouse 1, contained none of the ionocytes at all. A bootstrap ensemble drawing on runs like that one would have voted the cluster out of existence. Plasschaert and colleagues found the same cell type independently, at a different institution, published in the same issue: 1–2% of human airway epithelial cells, explaining 60% of mean CFTR channel current against 4% for ciliated cells.
Nor does averaging reliably buy accuracy in exchange. A benchmark of 14 clustering algorithms tested that trade directly. Duò and colleagues report: “Additionally, we found that consensus clustering typically did not improve the performance compared to the best of the combined methods, but that several of the top-performing methods already perform some type of consensus clustering.”
Consensus summarizes the ensemble you created; it cannot rescue missing evidence.
Case
Consensus clustering found stable clusters in null data
Consensus clustering was given data with no structure in it and returned stable-looking clusters anyway. Şenbabaoğlu and colleagues ran it on randomly generated unimodal data in 2014. The procedure “is able to divide randomly generated unimodal data into apparently stable clusters for a range of K, essentially reporting chance partitions of cluster-less data”. Where the structure was known, “the common implementations of CC perform poorly in identifying the true K”. Stability there was a property of the procedure, not of the population.
Analogy
Comparing several drafts of a coastline map
A coastline drawn from repeated surveys comes back slightly different every time. Major bays persist. Small inlets appear or disappear with resolution, weather, and sampling.
Polling assumes a defined question. Clustering can impose boundaries on a continuous population. Agreement across runs may therefore reflect repeated assumptions rather than a natural partition.
Look for persistent regions and persistent uncertainty, not only one final boundary.
Comparison
Partition agreement and cluster-level matching
Cluster IDs are arbitrary, so stability must be computed with label-invariant comparisons. The comparison itself needs a baseline, and the unadjusted measures do not have one. Vinh and colleagues showed that in 2010. Averaging over 200 random clusterings and all 19,900 pairs of them, mean MI, NMI and RI drift upward as K grows, VI drifts downward, and only ARI stays close to zero. Take a 100-item data set compared by two 10-cluster partitions. The expected mutual information is E{I(U,V)} = 0.4618, against a maximum of log(10) = 2.3. Roughly a fifth of the available scale is handed out for nothing, so “correction for chance is needed since the baseline is high”. They state the consequence plainly: “This is clearly an unwanted effect, since a consensus index built upon the MI, NMI and VI would be biased in favour of a larger number of clusters.” The bias is a function of how thinly the data are cut. At 1,000 items and 10 clusters, N/K = 100, the same bounds fall to 0.0764 and 0.0780, “small enough for many applications, therefore adjustment for chance might be omitted”. That is the operational rule. Around a hundred points per cluster, chance stops flattering you.
A chance-adjusted global score still tells you nothing about which group moved, and that is where instability actually lives. OPTIMA prelim randomised 313 women with early breast cancer; 302 of them had samples available for multiparameter testing. Five commercial multiparameter tests were run on those same 302 tumours. Bartlett and colleagues report the result in the abstract: “Only 119 (39.4%) tumors were classified uniformly as either low/intermediate risk or high risk, and 183 (60.6%) were assigned to different risk categories by different tests, although 94 (31.1%) showed agreement between four of five tests.” Pairwise kappas ran from 0.33 (MammaPrint vs IHC4) to 0.60 (IHC4 vs IHC4-AQUA). The three subtype callers looked closer still. Each assigned 59.5–62.4% of tumours to luminal A, an aggregate profile so similar that a summary statistic reads as near-agreement. They gave different subtypes to 123 tumours (40.7%). The marginal distributions matched; the patients did not.
Adjusted Rand index compares whether pairs are grouped together, adjusted for chance. It is invariant to cluster label names, defined for hard partitions, usable across different cluster counts, and silent about which groups changed. Adjusted mutual information measures shared information between partitions with the same chance correction. It handles label permutations and summarizes global agreement, but it can obscure local cluster instability and depends on partition granularity. Cluster matching aligns individual clusters using overlap, centroids, or assignment optimization. It locates the stable and unstable groups, needs a matching rule, can leave splits and merges ambiguous, and supports profile-level comparison. Only the third kind of comparison could have found OPTIMA's 123 reassigned tumours.
Adjusted Rand index
Compares whether pairs are grouped together, adjusted for chance.
- Invariant to cluster label names
- Supports hard partitions
- Can compare different cluster counts
- Does not locate which groups changed
Adjusted mutual information
Measures shared information between partitions with chance adjustment.
- Handles label permutations
- Summarizes global agreement
- Can obscure local cluster instability
- Depends on partition granularity
Cluster matching
Aligns individual clusters using overlap, centroids, or assignment optimization.
- Locates stable and unstable groups
- Needs a matching rule
- Can leave splits and merges ambiguous
- Supports profile-level comparison
Visual
Four sources of unsupervised variability
A robust result should be tested against more than random initialization. Optimization variation comes from seeds and initialization changing which local solution is reached. Sampling variation comes from bootstrap or subsampling changing which observations support the structure. Representation variation comes from features, scaling, missingness, and embeddings altering the geometry. Method variation comes from different algorithms rewarding different shapes, densities, and partitions. Temporal variation comes from later data introducing drift, new regimes, or changed measurement.
The last two have been measured rather than assumed. Duò and colleagues evaluated 14 R clustering algorithms across nine public scRNA-seq data sets and three simulations, and found substantial differences in performance, run time and stability between the methods. Krzak and colleagues evaluated 13 methods across 17 real and 25 simulated data sets, and attributed the great variability in performance to user-chosen parameter settings; most method and parameter combinations systematically under- or overestimated the number of clusters. A perturbation suite that varies only the seed is testing the one source of variation these benchmarks found least of.
Optimization variation
Seeds and initialization change local solutions.
Sampling variation
Bootstrap or subsampling changes which observations support the structure.
Representation variation
Features, scaling, missingness, and embeddings alter the geometry.
Method variation
Different algorithms reward different shapes, densities, and partitions.
Temporal variation
Later data can introduce drift, new regimes, or changed measurement.
A seed-stable result can still be representation-fragile or time-limited.
Steps
Build a stability report that identifies where change occurs
Global agreement should be paired with group-level and example-level diagnostics. First, define the perturbation suite: seeds, resamples, feature blocks, preprocessing variants, methods, and time windows. That is the Ben-Hur principle — perturb the data, compare the partitions that come back. Second, fit an ensemble, storing assignments, parameters, profiles, and diagnostics for every run. Third, compare globally with label-invariant, chance-adjusted agreement and cluster-count summaries; the unadjusted baseline is only negligible once N/K is around 100. Fourth, align groups to identify persistent clusters, splits, merges, and unmatched rare groups. The 40.7% of OPTIMA tumours that moved between subtype callers are invisible to any step that stops at step three. Fifth, inspect unstable points: observations that switch repeatedly or remain unassigned. Sixth, decide the response — keep alternatives, simplify the claim, collect data, or build a consensus partition, in the knowledge that consensus typically did not beat the best combined method in the benchmark that tested it.
1. Define perturbation suite
Include seeds, resamples, feature blocks, preprocessing variants, methods, and time windows.
2. Fit an ensemble
Store assignments, parameters, profiles, and diagnostics for every run.
3. Compare globally
Use label-invariant partition agreement and cluster-count summaries.
4. Align groups
Identify persistent clusters, splits, merges, and unmatched rare groups.
5. Inspect unstable points
Review observations that switch repeatedly or remain unassigned.
6. Decide response
Keep alternatives, simplify the claim, collect data, or build a consensus partition.
Reproducibility can include a map of disagreement
A trustworthy analysis does not need every observation to retain one label across every run. It needs to show which structures persist and where the evidence remains weak. A 26-cell cluster that one replicate out of six failed to contain is not a failure of the report; suppressing it would be.
Store stability artifacts with the cluster version. Downstream users should know whether a label belongs to a robust core, a contested boundary, or a transient regime. Where the groups feed a decision about individuals, they should also know whether the agreement being quoted is agreement about proportions or agreement about people.
Uncertainty about membership is part of the result, not a failed result.
Position
Finding a clustering is not evidence that clusters exist
Every partitioning algorithm returns a partition. Ask for four groups and four groups arrive, from structured data and from noise alike, and the two outputs are indistinguishable on the page. Choosing K by maximising a cluster-quality index does not fix this. The index is maximised on noise too. It simply reports which of the available partitions of the noise was tidiest.
That has been demonstrated on a published result. In 2017 Drysdale and colleagues reported in Nature Medicine that fMRI had subdivided depression into four neurophysiological “biotypes”. The sample was large and multisite: n = 1,188 patients and controls, with the cluster-discovery step itself analysing 220 depressed subjects. Dinga and colleagues then re-ran the same canonical-correlation-plus-hierarchical-clustering pipeline on 187 participants with depression and anxiety. Everything came back looking right: canonical correlations of 0.99 and 0.97, and an “optimal” three-cluster solution with the highest Calinski-Harabasz index, 109, and the highest silhouette index, 0.34. Then they asked what those numbers do when there is nothing there. The permutation tests on the correlations returned p = 0.64 and p = 0.99. The null simulation returned p = 0.45 for CH and p = 0.19 for silhouette. They state the conclusion plainly: “That means that it is not unusual to observe such high CH and silhouette indices, even when the hierarchical clustering is performed on a normally distributed data set (data with no clusters).” A maximum is not a discovery until you know the distribution of maxima under no structure.
Stability is the standard alternative answer, and the standard test was designed with the harder half in mind. Ben-Hur and colleagues subsample and compare, and “High pairwise similarities indicate a stable clustering pattern”. But the property worth insisting on is that the method “can also detect the lack of structure in data”. A procedure with no way of coming back empty has not tested anything. That is exactly where consensus clustering was caught. Şenbabaoğlu and colleagues ran it on randomly generated unimodal data and it divided them into apparently stable clusters over a range of K, “essentially reporting chance partitions of cluster-less data”, while on data with known structure “the common implementations of CC perform poorly in identifying the true K”. The device cluster at the start of this lesson is the mirror image. It survived every seed and every bootstrap sample, and its members shared one firmware version with a persistent logging offset. So write down, before the ensemble is fitted, which result would have said there was nothing here — a permutation p-value, a null simulation of the index, a subsample similarity indistinguishable from chance. Then check that the design can actually produce it.
A design that cannot report “no structure” has not tested for structure.
Key takeaways
- Stability should test seeds, samples, features, methods, and time — Krzak and colleagues traced the great variability across 13 methods, 17 real and 25 simulated data sets to user-chosen parameter settings, not to initialization.
- Partition comparisons must be label-invariant and chance-adjusted: two random 10-cluster partitions of 100 points already share E{I(U,V)} = 0.4618 of a possible 2.3, and the bias only fades near N/K = 100.
- Global agreement can hide specific clusters that split, merge, or disappear — in OPTIMA the three subtype callers each put 59.5–62.4% of tumours in luminal A while disagreeing about 40.7% of them individually.
- Consensus clustering summarizes an ensemble and inherits its blind spots; in the Duò benchmark of 14 methods it typically did not improve on the best of the combined methods.
- A stable pattern can still represent a stable confounder or data defect, and a maximised index — Calinski-Harabasz of 109, silhouette of 0.34 — can come from data with no clusters in it at all.
- Robust cores and unstable boundaries should be exposed to downstream users: a 0.42% ionocyte cluster, absent from one replicate, carried 54.4% of all detected Cftr transcripts.