Tutorials › Multi-Omics Data Integration › Co-Clustering Matrices As Stability Summaries

Stability of Discovered Subgroups · Tutorial 485 of 597

Co-Clustering Matrices As Stability Summaries

You will learn how to calculate and interpret pairwise co-clustering frequencies while accounting for runs in which samples are not eligible.

Advanced 11 min read

What You'll Learn

  • Define pairwise eligibility and co-assignment indicators for repeated clustering runs.
  • Calculate co-clustering frequencies using only runs in which both samples are eligible.
  • Interpret a frequency as conditional on the resampling and clustering procedure.
  • Read matrix patterns to distinguish consistently co-clustered pairs from unstable boundaries.
  • Diagnose low denominators, missing entries, and overinterpretation of a consensus-like matrix.

Why Summarize Repeated Runs Pair by Pair?

Repeated clustering runs can yield different partitions because the data, features, or training sets are perturbed. Cluster names such as “cluster 1” and “cluster 2” are arbitrary: changing those names does not change the partition. The earlier material on aligning cluster labels across resamples addresses label matching when labels themselves must be compared. A co-clustering matrix takes a different route: it asks whether each pair of samples was placed together, a question that is unchanged by relabeling.

The result is a sample-by-sample summary. A large entry means that the pair was frequently assigned to the same cluster among runs in which both samples could be evaluated. A small entry means they were rarely assigned together under those same conditions. The “among runs” qualification matters: a pair may be absent from some resamples, or a run may not produce a usable assignment for both samples.

Definition: Let \(i\) and \(j\) index samples, and let \(b=1,\ldots,B\) index repeated runs of a specified resampling and clustering procedure. Define \(O_{ij}^{(b)}=1\) if both samples are eligible for comparison in run \(b\), and \(O_{ij}^{(b)}=0\) otherwise. When \(O_{ij}^{(b)}=1\), define \(Z_{ij}^{(b)}=1\) if samples \(i\) and \(j\) are assigned to the same cluster in that run, and \(Z_{ij}^{(b)}=0\) if they are assigned to different clusters. \(Z_{ij}^{(b)}\) is defined only for eligible runs. The co-clustering frequency is $$ C_{ij}=\frac{\displaystyle\sum_{b:O_{ij}^{(b)}=1} Z_{ij}^{(b)}}{\displaystyle\sum_{b=1}^{B}O_{ij}^{(b)}}, $$ provided \(\sum_{b=1}^{B}O_{ij}^{(b)}>0\). If that denominator is zero, \(C_{ij}\) is undefined.

The denominator \(E_{ij}=\sum_{b=1}^{B}O_{ij}^{(b)}\) is the number of runs eligible for the pair. It should be recorded and interpreted alongside \(C_{ij}\). In particular, the numerator sums only the defined co-assignment indicators. An ineligible run contributes neither a co-assignment nor a separation; it is not treated as a zero.

What the Entries Mean

For each pair with \(E_{ij}>0\), \(C_{ij}\) is between 0 and 1. A value of 1 means the pair was together in every eligible run; a value of 0 means they were apart in every eligible run. Intermediate values are proportions. For example, \(C_{ij}=0.75\) means that the pair was co-assigned in three quarters of its eligible runs, not that either sample has a 75% probability of belonging to a particular named cluster.

If the runs are generated as repeated random draws from a specified perturbation procedure, the target quantity can be written as the conditional probability \(P(Z_{ij}=1\mid O_{ij}=1)\): the probability of co-assignment in a run, conditional on both samples being eligible. The observed frequency estimates that probability. This interpretation depends on the run-generation procedure; changing the resampling unit, feature perturbation, preprocessing, or clustering settings can change the probability being summarized. If runs are a fixed collection rather than random draws, the frequency is a descriptive proportion for that collection.

The matrix is symmetric because the same two samples form the pair regardless of order: \(C_{ij}=C_{ji}\) whenever the entries are defined. Its diagonal is 1 when a sample is eligible in at least one run, since a sample is in the same cluster as itself. If a sample is never eligible, its diagonal entry is undefined. A zero off-diagonal entry is meaningful only when \(E_{ij}>0\); an undefined entry must not be displayed or interpreted as zero.

Worked Example: Calculating a Pairwise Frequency

Suppose five hypothetical clustering runs are performed. For samples A and B, both are eligible in runs 1, 2, 4, and 5; B is not eligible in run 3. Their assignments are the same in runs 1, 4, and 5, and different in run 2.

The eligible-run set is \(\{1,2,4,5\}\), so \(E_{AB}=4\). The co-assignment indicators on that set are 1, 0, 1, and 1. Therefore,

$$ C_{AB}=\frac{1+0+1+1}{4}=\frac{3}{4}=0.75. $$

The pair was together in 75% of the runs in which both samples could be compared. Run 3 does not enter the calculation. In particular, \(Z_{AB}^{(3)}\) is undefined, so it is not included as a zero in the numerator.

From Runs to a Matrix

A practical construction records two quantities for every pair: its eligible-run count \(E_{ij}\) and its co-clustering frequency \(C_{ij}\). The same eligibility rule must be applied consistently. For instance, if the analysis defines a sample as eligible only when it appears in a resample and receives a cluster assignment, both conditions must hold for each member of the pair. If assignments are available for samples outside a resample, use those assignments only if that was part of the prespecified run procedure; do not silently mix in-sample and out-of-sample rules.

The following justification shows why the frequency estimates a conditional co-assignment probability under a random-run interpretation. For an eligible run, \(Z_{ij}\) is a binary indicator. Conditional on eligibility, its expectation is the probability of co-assignment:

$$ E(Z_{ij}\mid O_{ij}=1)=1\cdot P(Z_{ij}=1\mid O_{ij}=1)+0\cdot P(Z_{ij}=0\mid O_{ij}=1) =P(Z_{ij}=1\mid O_{ij}=1). $$

If eligible runs are independent draws from the same run-generating procedure, the eligible indicators \(Z_{ij}\) are identically distributed Bernoulli observations conditional on eligibility. Their sample mean is the displayed \(C_{ij}\), so as the number of eligible runs grows it converges to that conditional probability. This justification does not make the runs independent if the procedure creates dependent perturbations, nor does it make the result generalize beyond the specified procedure.

Worked Example: Reading a Small Co-Clustering Matrix

Consider four hypothetical samples and four runs in which all samples are eligible. The partitions are: run 1, \(\{A,B\},\{C,D\}\); run 2, \(\{A,B,C\},\{D\}\); run 3, \(\{A\},\{B\},\{C,D\}\); and run 4, \(\{A,B\},\{C\},\{D\}\). Each pair has denominator 4.

A and B are together in runs 1, 2, and 4, so \(C_{AB}=3/4=0.75\). A and C are together only in run 2, giving \(C_{AC}=1/4=0.25\). A and D are never together, giving \(C_{AD}=0/4=0\). B and C are together only in run 2, so \(C_{BC}=0.25\); B and D are never together, so \(C_{BD}=0\). C and D are together in runs 1 and 3, giving \(C_{CD}=2/4=0.50\).

The resulting matrix is

$$ \begin{pmatrix} 1 & 0.75 & 0.25 & 0 \\ 0.75 & 1 & 0.25 & 0 \\ 0.25 & 0.25 & 1 & 0.50 \\ 0 & 0 & 0.50 & 1 \end{pmatrix}. $$

A and B show comparatively strong pairwise co-assignment, whereas A and D and B and D were never joined. The value 0.50 for C and D indicates an even split across these four runs. These are pair-level summaries, not proof that a particular final partition is correct.

Eligibility Changes the Interpretation

Pair-specific denominators are essential when samples are absent from different resamples. The numerator and denominator must refer to the same eligible runs. A pair with a frequency of 1 based on one eligible run has weaker empirical support than a pair with a frequency of 1 based on many eligible runs. The frequencies alone hide this distinction.

Worked Example: Unequal Eligibility Across Pairs

Suppose there are three hypothetical samples, A, B, and C, and five runs. In runs 1, 3, and 5, only A and C are eligible: they are together in runs 1 and 5, and apart in run 3. In runs 2 and 4, all three samples are eligible; B and C are together in both runs, while A is separate from them.

For A and C, the eligible runs are 1, 3, and 5. They are together twice, so \(E_{AC}=3\) and \(C_{AC}=2/3\approx0.667\). For B and C, both are eligible in all five runs and together only in runs 2 and 4. Thus \(E_{BC}=5\) and \(C_{BC}=2/5=0.40\).

These values summarize different eligible-run sets. A has no assignment in runs 2 and 4, so those runs cannot be counted as evidence that A and C were apart. The example also shows why reporting \(E_{ij}\) beside \(C_{ij}\) helps readers assess how much run information supports each entry.

Patterns, Diagnostics, and Limits

A heat map of \(C_{ij}\), with samples ordered in a meaningful way, can make stable-looking groups and uncertain interfaces visible. Blocks of high values suggest pairs that are repeatedly co-assigned; low values between blocks suggest repeated separation. Values that change gradually across a boundary, or pairs with intermediate frequencies, flag relationships that depend more strongly on the perturbation. These visual patterns guide inspection, but do not by themselves establish the number of groups or identify a unique partition.

Inspect the denominator matrix as well as the frequency matrix. Look for pairs with few eligible runs, entire samples with little eligibility, and discrepancies in eligibility caused by a coding or assignment rule. Check that the matrix is symmetric, that defined diagonal entries are 1, and that every reported frequency lies between 0 and 1. An undefined pair should be marked as missing, not colored as though its frequency were zero. If a heat map gives the same visual weight to a pair based on very few runs as to one based on many, show the eligible counts or otherwise make that limitation clear.

There are important limits to the summary. Co-clustering frequencies discard the identities of cluster labels and reduce repeated partitions to pairwise relationships. Consequently, the matrix does not retain all the information in the runs. In particular, its entries are averages across runs: they need not describe any one partition that actually occurred. A pairwise pattern should therefore not be presented as if it were itself a fitted clustering. The matrix also reflects the full analysis choices used in the runs; it is not a measure of biological truth or evidence that cluster membership causes an outcome.

Co-clustering is useful when the central question is which sample pairs repeatedly travel together. Other summaries answer different questions. Label alignment supports comparisons of named clusters when the matching of labels is meaningful. A single run-to-run agreement statistic compresses comparison into a scalar and therefore does not show which pairs account for disagreement. Cluster-specific summaries focus on individual groups. These approaches are complementary; the pairwise matrix is particularly helpful for seeing local patterns and boundaries, while its many entries should not be mistaken for independent observations or a complete account of clustering stability.

Common Mistakes

  • Counting an ineligible run as a separation. “The pair was not together because one sample was absent” is incorrect. The run supplies no pairwise comparison; exclude it from both numerator and denominator.
  • Using a common denominator for every pair. This is wrong when pairs have different eligibility. Calculate \(E_{ij}\) separately for each pair and divide only by that pair’s count.
  • Calling an undefined entry zero. Zero means the pair was eligible and separated every time. No eligible runs means there is no observed frequency to interpret.
  • Reading a high value as a membership probability. The entry is a conditional pairwise co-assignment frequency under a particular run procedure, not the probability that a sample belongs to a named subtype.
  • Treating the matrix as a final partition. Pairwise averages summarize repeated partitions; they do not necessarily correspond to a partition observed in any run.
Key takeaway: Construct each entry from the runs in which both samples are eligible, and report the eligible-run count alongside the frequency. Interpret the result as pairwise co-assignment under the specified perturbation procedure—not as a named-cluster probability or a final clustering.

Check Your Understanding

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

  1. A pair is eligible in six runs and co-assigned in four. What are its eligible-run count and co-clustering frequency?
  2. A pair is eligible in three runs and co-assigned in all three. Is its frequency 1? What information should accompany that value?
  3. In a run, one member of a pair is absent. Should that run contribute zero to the numerator? Explain.
  4. What does an entry \(C_{ij}=0.30\) mean if \(E_{ij}=10\)?
  5. Why can a co-clustering matrix summarize repeated partitions without being a partition itself?

Solutions. (1) \(E_{ij}=6\), and \(C_{ij}=4/6\approx0.667\). (2) Yes, the observed frequency is \(3/3=1\); report \(E_{ij}=3\), since the value is based on only three eligible runs. (3) No. The pair is ineligible, so its co-assignment indicator is undefined and the run contributes to neither numerator nor denominator. (4) The pair was co-assigned in three of its ten eligible runs. This is a frequency under the specified run procedure, not a named-cluster membership probability. (5) Each entry averages a pairwise indicator across runs. Different entries can average different run patterns, so the collection of averages need not be the pairwise pattern of any single observed run.

Clinical Biostats