Why Rare Labels Need a Separate Uncertainty Check
A classifier can perform well overall and still struggle with a rare cell type. Overall accuracy may barely change when a small class is consistently missed, and a single cell can substantially change a rare class’s estimated performance. A useful diagnosis therefore asks two different questions: how uncertain is the estimate? and do the observed errors show a repeated pattern?
The key denominator for recall is the number of evaluated cells whose reference label is the rare type—not the total number of cells, and not the number of cells assigned that label by the classifier. Probability calibration asks a related but distinct question: among cells given a particular probability for the type, how often is that type actually the reference label? Both questions need enough relevant validation observations to support a stable estimate.
This is a conditional performance measure: it conditions on the reference label being \(c\). It is not the fraction of predicted-\(c\) cells that are correct; that is precision. A rare type in the data need not have imprecise recall if many validation cells of that type have been collected. Conversely, a reasonably common type can have an imprecise estimate if its validation count is small.
Uncertainty in Classwise Recall
A simple model treats the correctness indicator for each evaluated reference-\(c\) cell as a Bernoulli variable: it equals 1 if predicted correctly and 0 otherwise. If the classifier is fixed, the cells are representative of the target population of interest, and their outcomes are independent with a common probability \(r_c\), then \(x_c\) has a binomial distribution with size \(n_c\) and success probability \(r_c\). Under this model, \(\hat{r}_c\) estimates \(r_c\), with standard error approximately \(\sqrt{\hat{r}_c(1-\hat{r}_c)/n_c}\). That approximation can behave poorly for small counts or estimates near 0 or 1, so a Wilson interval is often preferable to a simple estimate-plus-or-minus-standard-error interval.
The Wilson interval is obtained by inverting the score test for a binomial proportion. For a candidate probability \(p\), the score-test acceptance condition is \(n(\hat{p}-p)^2\le z^2p(1-p)\). Expanding and collecting terms gives
The endpoints are the two roots of this quadratic. Completing the quadratic formula gives \(C-H\) and \(C+H\) above. Unlike a symmetric normal interval, these endpoints remain between 0 and 1 and need not be centered on \(\hat{p}\).
Worked Example: The Same Recall Estimate, Different Evidence
Suppose two hypothetical validation sets each yield 70% recall for a rare type. In the first, 7 of 10 reference-type cells are correctly assigned; in the second, 70 of 100 are. The proportions match, but the evidence does not have the same precision.
For \(x=7\), \(n=10\), \(\hat{r}=0.70\), and \(z=1.96\), the Wilson denominator is \(1+3.8416/10=1.38416\). The center is \(C=(0.70+3.8416/20)/1.38416=0.6445\), and the half-width is \(H=1.96\sqrt{0.70(0.30)/10+3.8416/400}/1.38416=0.2477\). The interval is approximately \([0.397,0.892]\).
For \(x=70\), \(n=100\), the denominator is \(1.038416\), the center is \(0.6926\), and the half-width is \(0.0884\). The interval is approximately \([0.604,0.781]\). Both estimates are 70%, but the first is compatible with a much broader range of recall values. The 95% interval procedure has approximately 95% coverage over repeated samples under the binomial assumptions; this particular interval is not a statement that there is a 95% probability the fixed recall lies inside it.
Calibration Requires Class-Specific Evidence Too
A classifier may output, for each cell \(i\) and type \(c\), a probability \(q_{ic}\) that the cell belongs to \(c\). Calibration for type \(c\) means that among cells assigned probabilities near \(q\) for that type, the fraction whose reference label is \(c\) is near \(q\). In notation, the ideal condition is \(P(Y_i=c\mid q_{ic}=q)=q\), where \(Y_i\) is the reference label. In finite data, this is examined over probability ranges or bins.
For rare types, a bin can contain very few validation cells, so its observed fraction correct can vary widely. Report the number of cells contributing to each class-and-probability bin alongside its average predicted probability and observed fraction. A reliability diagram without these counts can make a noisy point look as authoritative as a point supported by many observations. Binning also hides variation within a bin, so apparent agreement is not proof of perfect calibration.
Worked Example: A Sparse Calibration Bin
In a hypothetical validation set, 10 cells fall in a bin for which their average predicted probability of type \(c\) is 0.80. Six of the 10 have reference label \(c\), so the observed fraction is \(6/10=0.60\). The difference between observed and predicted fractions is \(0.60-0.80=-0.20\), or 20 percentage points below the prediction.
The Wilson interval for the observed fraction uses \(x=6\), \(n=10\), and \(\hat{p}=0.60\). Its denominator is \(1.38416\); its center is \((0.60+3.8416/20)/1.38416=0.5722\), and its half-width is \(1.96\sqrt{0.60(0.40)/10+3.8416/400}/1.38416=0.2596\). The interval is approximately \([0.313,0.832]\). It includes 0.80, so these data do not establish a clear calibration discrepancy at that probability level. They also do not demonstrate precise calibration: the interval is wide. The bin’s 10 cells warrant caution, not a confident declaration that the model is calibrated or miscalibrated.
Reference Counts and Validation Counts Answer Different Questions
The number of cells of type \(c\) in a reference atlas describes how much reference material is available for representing that label. It can flag limited support: a type represented by only a few cells may be difficult to characterize across its biological variation. But that atlas count is not automatically the denominator for validation recall. Recall must use independently evaluated cells with a reference label of \(c\). Likewise, the number of atlas cells does not show how well probabilities are calibrated on a target dataset.
Keep at least three counts conceptually separate: the number of reference-atlas cells of type \(c\), the number of validation cells with reference label \(c\), and the number of cells assigned label \(c\) by the classifier. They have different roles. A very small atlas count suggests limited representation; a small validation count yields imprecise performance estimates; a small predicted count may affect precision or the practical yield of that label. None can be substituted for another.
Worked Example: Limited Support or a Repeated Confusion?
Suppose a hypothetical atlas contains four cells labeled as a rare subtype \(c\). In a separate validation set, 24 cells have reference label \(c\); 15 are predicted as \(c\), while 8 of the 9 errors are predicted as neighboring type \(b\). The validation recall is \(15/24=0.625\). Its Wilson interval is approximately \([0.427,0.788]\): with \(z=1.96\), the denominator is \(1+3.8416/24=1.1601\), the center is \((0.625+3.8416/48)/1.1601=0.6078\), and the half-width is \(1.96\sqrt{0.625(0.375)/24+3.8416/(4(24)^2)}/1.1601=0.1806\).
The four atlas cells indicate limited reference support, but they are not the validation denominator: the recall estimate uses 24 independently evaluated reference-\(c\) cells. The interval is broad, so the precise underlying recall remains uncertain. Separately, 8 of the 9 observed errors favor the same label \(b\), which is a directional pattern worth investigating. It is not by itself proof of a biological or technical cause. Check the reference labels and the cells’ marker evidence, and examine whether the pattern persists across independent donors or other suitable validation data. If the evaluation cells are clustered within donors, the displayed binomial interval may be too narrow because their errors need not be independent.
Diagnostics, Alternatives, and Limits
A useful rare-label report places the estimate, its denominator, and its uncertainty together. For each type, inspect the recall numerator and denominator, the interval, and the destinations of errors. For calibration, show class-specific bin counts as well as average predicted and observed probabilities. Compare results across donors or other independent sampling units when possible. A class with wide intervals and errors scattered among labels presents a different diagnostic picture from one with repeated errors to the same competing type, even if the point recalls happen to match.
The binomial interval is a practical alternative to reporting a point estimate alone, but its assumptions matter. If multiple cells come from the same donor, treating every cell as an independent Bernoulli observation can overstate the effective sample size. Donor-level summaries, resampling donors, or a model that accounts for clustering may be more suitable, depending on the design and estimand. If the reference labels themselves are uncertain or inconsistent, the calculation quantifies agreement with those labels, not error relative to an unquestionable biological truth.
Other summaries answer different questions. Overall accuracy weights types according to their frequency and can obscure rare-type failures. Precision focuses on the correctness of predicted labels rather than recovery of reference-labeled cells. A confusion matrix displays where errors go, while recall intervals quantify uncertainty in a classwise proportion. Reliability diagrams assess probability calibration, not whether the predicted class is biologically correct in every individual case. No single summary replaces the others.
A large reference count does not guarantee a representative reference, and a small count does not prove that predictions are wrong. Similarly, a low recall estimate with a wide interval is not evidence that recall is acceptable; it is evidence that the available data do not pin it down precisely. Treat absence of evidence for systematic misclassification separately from evidence of good performance.
A Practical Diagnostic Sequence
Define the rare type and count validation cells whose reference label is that type. Do not use predicted-label counts as the recall denominator.
Report correct predictions divided by reference-type validation cells, with a binomial interval when its independence assumptions are reasonable.
For class-specific probabilities, show bin counts, mean predictions, and observed fractions. Treat sparse bins as imprecise.
Tabulate competing labels for the errors and check whether conclusions are supported across independent donors or other relevant units.
Common Mistake
- Wrong reasoning: “The atlas has only four cells of this rare type, so the recall denominator is four and its estimated recall is unreliable for that reason.”
- Correction: Atlas representation and validation evidence are distinct. Recall uses the independently evaluated cells with that reference label. A small atlas count is a warning about reference support; a small validation count is what directly limits precision of the recall estimate.
- Wrong reasoning: “The rare type has lower recall, so the classifier systematically confuses it with one particular neighboring type.”
- Correction: Low estimated recall alone does not identify the error pattern. Inspect the destinations of errors and their consistency, and account for the uncertainty in those observations.
Check Your Understanding
Answer each question, then compare your reasoning with the brief solutions.
- A validation set has 12 reference-\(c\) cells, of which 9 are predicted as \(c\). What is the classwise recall, and which count is its denominator?
- Why can two rare-label recall estimates of 0.70 have different uncertainty?
- A type has 3 cells in the reference atlas and 30 reference-labeled cells in validation. Which count is used for recall, and what does the atlas count indicate?
- In a calibration bin, the mean probability is 0.75 and 4 of 5 cells have the target reference label. What are the observed fraction and the main interpretive caution?
- What additional concern arises if the validation cells used for a binomial interval come from a small number of donors?
Solutions: (1) Recall is \(9/12=0.75\), or 75%; its denominator is the 12 validation cells with reference label \(c\). (2) Their validation denominators may differ; a larger denominator usually gives greater precision under the same sampling assumptions. (3) Use the 30 validation cells as the recall denominator; the atlas count of 3 signals limited reference representation, not a substitute validation count. (4) The observed fraction is \(4/5=0.80\); with only five cells, that estimate is highly imprecise and should not be treated as strong evidence of calibration. (5) Cells from the same donor may have correlated outcomes, making an independent-cell binomial interval too narrow; use an approach that respects the donor-level sampling structure.