Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Separating Model Uncertainty From Cell Ambiguity

Cell-Type Annotation and Its Uncertainty · Tutorial 344 of 700

Separating Model Uncertainty From Cell Ambiguity

Use the spread and entropy of ensemble predictions to tell whether an uncertain cell label reflects model instability, persistent ambiguity, or both.

Intermediate 11 min read

What You'll Learn

  • Define ensemble-based model uncertainty and within-model predictive ambiguity for a cell.
  • Decompose predictive entropy into average within-model entropy and between-model disagreement.
  • Calculate and interpret both components from hypothetical cell-type predictions.
  • Diagnose when an ensemble is not a credible representation of model uncertainty.
  • Recognize why persistent ambiguity does not establish a cell’s biological identity.

Two Different Sources of an Uncertain Label

A cell can receive an uncertain annotation for more than one reason. Plausible fitted models may disagree about its label, or different plausible labels may remain likely even when the fitted model changes very little. Those patterns call for different interpretations. A single probability vector can show that the prediction is uncertain overall, but cannot by itself distinguish these sources.

An ensemble makes the distinction visible by producing a probability vector for the same cell from each of several fitted models or resampled references. Variation across those vectors is evidence of model instability under the ensemble procedure. Uncertainty that remains within the vectors, even when they are similar to each other, is evidence of persistent ambiguity in the cell’s predictive evidence. Neither pattern alone establishes the biological cause of uncertainty.

The calculations below assume that all ensemble members predict the same cell against the same harmonized set of \(K\) labels. Probabilities must use the same label definitions and order, and each vector must sum to one. This comparability matters: disagreement caused only by differently named or defined labels is not model uncertainty about a common outcome.

Definition: For cell \(i\), let \(p_{imk}\) be model \(m\)'s predicted probability for label \(k\), where \(m=1,\ldots,M\) and \(k=1,\ldots,K\). For an equally weighted ensemble, the mean prediction is \(\bar p_{ik}=M^{-1}\sum_{m=1}^{M}p_{imk}\). The entropy \(H(\mathbf p_{im})=-\sum_{k=1}^{K}p_{imk}\log_2(p_{imk})\) measures uncertainty within model \(m\)'s probability vector; define \(0\log_2(0)=0\). The mean within-model entropy is \(U_{\mathrm{within},i}=M^{-1}\sum_m H(\mathbf p_{im})\). The between-model component is \(U_{\mathrm{between},i}=H(\bar{\mathbf p}_i)-U_{\mathrm{within},i}\). Entropies are in bits.

The mean vector \(\bar{\mathbf p}_i\) summarizes the ensemble’s average probabilities. Its entropy is the cell’s total predictive entropy under that ensemble. The within-model component is large when individual models themselves spread probability across labels. The between-model component is large when model predictions differ from one another. A large between-model component can occur even when each model is individually confident.

The term “within-model” describes a property of the predicted probability vector, not a direct observation of a cell’s irreducible biological uncertainty. In particular, model probabilities should not be read as calibrated chances of the cell’s true type unless calibration and the relevant validation conditions support that interpretation. The entropy decomposition is an exact mathematical description of the ensemble predictions; its biological meaning depends on how the models and reference resamples were constructed.

Why the Entropy Decomposition Works

Imagine first selecting an ensemble member \(M\) at random, then drawing a predicted label \(Y\) according to that member’s probabilities for the cell. With equal ensemble weights, \(P(M=m)=1/M\), and \(P(Y=k\mid M=m)=p_{imk}\). The marginal probability of label \(k\) is therefore \(P(Y=k)=\bar p_{ik}\).

The entropy chain rule states that the uncertainty in \(Y\) can be written as uncertainty in \(Y\) given the selected model, plus the information about \(Y\) supplied by knowing the model. In this construction, the first term is average within-model entropy. The second is the between-model component:

$$ H(Y)=H(Y\mid M)+I(Y;M) $$

Here \(H(Y)=H(\bar{\mathbf p}_i)\), \(H(Y\mid M)=M^{-1}\sum_m H(\mathbf p_{im})\), and \(I(Y;M)\) is the mutual information between the ensemble-member index and predicted label. Thus \(U_{\mathrm{between},i}=I(Y;M)\). This also shows why the between-model component cannot be negative: mutual information is nonnegative. It is zero when knowing which ensemble member was selected does not change the predictive distribution of the label.

The equality follows by expanding the joint entropy in two ways. Because \(P(M=m,Y=k)=M^{-1}p_{imk}\), the chain rule gives \(H(Y,M)=H(M)+H(Y\mid M)\). Reversing the order gives \(H(Y,M)=H(Y)+H(M\mid Y)\). Subtracting the second expression from the first yields \(H(Y)-H(Y\mid M)=H(M)-H(M\mid Y)=I(Y;M)\). The between-model quantity is also called the Jensen–Shannon divergence of the ensemble’s probability vectors from their mean, with equal weights.

If ensemble members have justified unequal weights \(w_m\), use \(w_m\geq0\), \(\sum_m w_m=1\), and replace each average over models with a weighted average. The decomposition still holds when model selection is represented by those weights. Arbitrary weights, however, do not automatically make the ensemble more representative of plausible fitted models.

Worked Example: Unstable Predictions Across Resampled References

Suppose four hypothetical reference resamples produce probabilities for a cell in two labels, T and B. Their vectors, in that order, are \((0.90,0.10)\), \((0.80,0.20)\), \((0.85,0.15)\), and \((0.25,0.75)\). Treat the four resamples as equally weighted ensemble members.

The mean probabilities are \(\bar p_T=(0.90+0.80+0.85+0.25)/4=0.70\) and \(\bar p_B=0.30\). The total predictive entropy is \(H(0.70,0.30)=-0.70\log_2(0.70)-0.30\log_2(0.30)=0.8813\) bits.

The four within-model entropies are approximately \(0.4690\), \(0.7219\), \(0.6098\), and \(0.8113\) bits. Their mean is \(U_{\mathrm{within}}=(0.4690+0.7219+0.6098+0.8113)/4=0.6530\) bits. Consequently, \(U_{\mathrm{between}}=0.8813-0.6530=0.2283\) bits.

The vectors are not all alike: three favor T, while the fourth favors B. The positive between-model component reflects that sensitivity. The mean still favors T, but the ensemble mean alone conceals the strong change in the fourth resample. These numbers diagnose instability under this particular resampling procedure; they do not establish which label is correct.

Worked Example: Persistent Ambiguity With Little Model Disagreement

For another hypothetical cell, four fitted models give probabilities for labels T and B of \((0.55,0.45)\), \((0.58,0.42)\), \((0.53,0.47)\), and \((0.56,0.44)\). The predictions are all close, but none strongly favors one label.

The mean vector is \((0.555,0.445)\). Its entropy is \(H(0.555,0.445)\approx0.9913\) bits, close to the maximum of 1 bit for two labels. The individual entropies are approximately \(0.9928\), \(0.9815\), \(0.9974\), and \(0.9896\) bits. Their mean is approximately \(0.9903\) bits, so \(U_{\mathrm{between}}\approx0.9913-0.9903=0.0010\) bits.

This ensemble has little variation across fitted models, but high predictive entropy within each model. The appropriate description is persistent ambiguity in these model predictions, not substantial model instability. The calculation does not tell us whether the cell lies between biological types, has weak or noisy evidence, or is affected by some other limitation of the measurement or reference.

Comparing the Components in Practice

The decomposition separates patterns that a single uncertainty score merges. For two labels, consider these two hypothetical ensembles. In the first, every model predicts \((0.50,0.50)\). In the second, half predict \((1,0)\) and half predict \((0,1)\). Both have the same mean prediction, \((0.50,0.50)\), and total entropy of 1 bit. But their components differ:

$$ \begin{aligned} \text{Same uncertain vector in every model:}\quad &U_{\mathrm{within}}=1,\quad U_{\mathrm{between}}=1-1=0.\\ \text{Confident models split between labels:}\quad &U_{\mathrm{within}}=0,\quad U_{\mathrm{between}}=1-0=1. \end{aligned} $$

In the first pattern, uncertainty is present within each model’s predictions. In the second, uncertainty in the ensemble mean arises entirely because models disagree. An entropy or margin calculated only from the ensemble mean cannot distinguish them. Comparing it with average within-model entropy can.

A second useful diagnostic is the spread of each label’s predicted probability across models. For example, inspect the range or standard deviation of \(p_{imk}\) across \(m\), alongside the entropy decomposition. These summaries can reveal whether a large between-model component is driven by one unusual fit or is shared across many models. They do not replace the decomposition, and their scales differ from entropy. Report the ensemble construction and the number and type of fitted models or resamples so the source of variation is interpretable.

1
Make predictions comparable.
For each cell, collect probabilities over the same harmonized label set. Check that each vector is nonnegative and sums to one, allowing only rounding error.
2
Define what varies.
Specify whether ensemble members differ by fitted model, reference resample, or another deliberate perturbation. Keep the cell and its measured evidence fixed when diagnosing variation across fits.
3
Calculate both components.
Find the ensemble mean, its entropy, and the average member entropy. Subtract average within-model entropy from total predictive entropy to obtain between-model disagreement.
4
Describe the pattern, not an unsupported cause.
Report whether uncertainty is primarily within-model, between-model, or both. Treat the result as conditional on the chosen ensemble and prediction procedure.

Assumptions, Diagnostics, and Failure Modes

The arithmetic decomposition requires probability vectors over a common set of labels and a defined weighting of ensemble members. Interpreting its components as a useful diagnostic additionally requires that the ensemble variation be meaningful. Members should represent plausible alternatives under the modeling or resampling question, rather than mostly duplicated fits or arbitrary perturbations. If predictions are badly calibrated, entropy remains a valid summary of the reported numbers but may not measure uncertainty about true labels well.

Inspect the individual prediction vectors as well as their summaries. A very large between-model component may be driven by one failed fit, a small class absent from a resample, unstable optimization, or inconsistent preprocessing. Verify that model fits converged, labels were aligned correctly, and the cell was processed consistently. If resampling references, specify the resampling unit and scheme: resampling individual cells when the intended uncertainty concerns independent donors, for example, may not represent the relevant source of variation.

An ensemble with low between-model disagreement is not proof of a reliable answer. All members can share the same misspecification, reference limitation, or uninformative evidence. Conversely, high disagreement does not prove that the cell is biologically ambiguous: it may reflect a fragile model fit or a poorly chosen ensemble. Calibration, held-out validation, and other evidence can inform interpretation, but this diagnostic does not replace them.

There is also a conceptual limit. Predictive entropy within a model is sometimes informally called “cell ambiguity” or “aleatoric uncertainty.” It is safer to call it within-model predictive ambiguity: without additional assumptions and evidence, it cannot establish irreducible biological ambiguity in the cell. A cell at a transitional state is one possible explanation, but the probabilities alone do not distinguish that from weak measurements, imperfect labels, or model limitations.

Common Mistake and Main Alternatives

Wrong reasoning: “The ensemble mean assigns 50% to each of two labels, so every model is uncertain about this cell.” That conclusion does not follow. The mean can arise from every model assigning \((0.50,0.50)\), or from half the models confidently assigning one label and half confidently assigning the other. Both have the same mean entropy; their within-model and between-model components are different.

The correction is to retain the member-level probability vectors and compare the entropy of their mean with their average entropy. A hard-label vote can also indicate disagreement, but it discards how confident each member is: predictions of \((0.51,0.49)\) and \((0.99,0.01)\) both vote for the first label. The entropy decomposition uses the full probabilities.

Other uncertainty summaries answer related but different questions. Entropy and margin applied to one probability vector summarize uncertainty within that vector, as covered in the earlier material on entropy and margin measures. Calibration checks whether predicted probabilities agree with observed frequencies in appropriate validation data; it does not itself separate ensemble disagreement from within-model entropy. Conformal prediction sets address set-valued coverage under their assumptions, rather than decomposing ensemble entropy. These approaches can complement the present diagnostic, but none makes its interpretation automatic.

Worked Example: Same Mean, Different Diagnoses

Consider two hypothetical ensembles of two-label predictions. Ensemble A has two members, both predicting \((0.50,0.50)\). Ensemble B has one member predicting \((1,0)\) and the other predicting \((0,1)\). Compare their components.

Both ensemble means are \((0.50,0.50)\), so each has total entropy \(-0.50\log_2(0.50)-0.50\log_2(0.50)=1\) bit.

For A, each member has entropy 1 bit, giving \(U_{\mathrm{within}}=(1+1)/2=1\) bit and \(U_{\mathrm{between}}=1-1=0\) bits. For B, each member has entropy 0 bits, giving \(U_{\mathrm{within}}=(0+0)/2=0\) bits and \(U_{\mathrm{between}}=1-0=1\) bit.

Thus A shows shared within-model ambiguity, while B shows complete disagreement among confident members. The equal mean predictions do not justify equal explanations of uncertainty.

Key takeaway: For a fixed cell and a comparable ensemble, total predictive entropy splits exactly into average within-model entropy and between-model disagreement. Read both components, inspect member-level predictions, and describe the result as conditional on the ensemble rather than as proof of a biological cause.

Check Your Understanding

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

  1. Three equally weighted models predict \((0.8,0.2)\), \((0.8,0.2)\), and \((0.8,0.2)\). Is between-model disagreement positive? What kind of uncertainty is present?
  2. Two equally weighted models predict \((1,0)\) and \((0,1)\). Find the mean prediction, total entropy, average within-model entropy, and between-model component, in bits.
  3. Why must label definitions and ordering be aligned before comparing ensemble probabilities?
  4. Does a near-zero between-model component prove that the annotation is correct? Explain.

Solutions. (1) The mean equals each model’s vector, so total entropy equals average within-model entropy and the between-model component is zero. Each model has binary entropy \(-0.8\log_2(0.8)-0.2\log_2(0.2)\approx0.7219\) bits; the uncertainty is within-model predictive ambiguity. (2) The mean is \((0.5,0.5)\), with total entropy 1 bit. Both member vectors have entropy 0, so average within-model entropy is 0 and the between-model component is \(1-0=1\) bit. (3) Without aligned labels, apparent probability differences may represent different label meanings or ordering rather than disagreement about the same outcomes; the decomposition would not have a coherent interpretation. (4) No. The ensemble may share the same error or limitation. Near-zero disagreement says only that these members make similar predictions under this ensemble construction.

Clinical Biostats