Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Donor-Held-Out Validation of Cell-Type Annotation

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

Donor-Held-Out Validation of Cell-Type Annotation

Learn to evaluate cell-type annotation on unseen donors by keeping every cell from a donor in the same validation group and interpreting performance at the donor level.

Intermediate 12 min read

What You'll Learn

  • Explain how shared donor profiles make random cell-level splits optimistic for new-donor performance.
  • Construct donor-disjoint training and test sets and grouped cross-validation folds.
  • Distinguish cell-weighted accuracy from average donor-level accuracy.
  • Identify preprocessing and model-selection steps that can leak held-out donor information.
  • Summarize between-donor variability and recognize the limits of few-donor validation.

Why the Split Unit Matters

A cell-type annotation model is useful only to the extent that it works on the cells to which it will be applied. In many studies, the intended use is to annotate cells from a donor not used to fit or select the model. Validation must therefore mimic that use. If cells from the same donor appear in both training and test sets, the test can reward recognition of donor-specific profiles rather than recognition of cell types that generalize across donors.

Cells from one donor share biological and technical features. These may include genuine donor-specific expression, tissue condition, sample handling, sequencing depth, and processing effects. A model can exploit some of these patterns, even if they are not the intended basis for assigning cell types. A random split of individual cells can place near-replicates of these donor characteristics on both sides of the split. Holding out entire donors tests a more demanding and often more relevant target: performance on new biological donors drawn from the population of interest.

Definition: In donor-held-out validation, all cells from a given donor are assigned to one partition only. For a single holdout, training uses cells from a set of donors and evaluation uses cells from donors absent from training. In grouped cross-validation, the groups are donors, and each fold holds out one or more complete donor groups.

Let \(d(i)\) denote the donor from which cell \(i\) came, \(Y_i\) its reference cell-type label, and \(\hat{Y}_i\) the model's predicted label. A donor-held-out test set \(T\) is donor-disjoint from the training set \(R\): \(d(i)\ne d(j)\) for every \(i\in T\) and \(j\in R\). The model and any fitted preprocessing steps are learned using \(R\), then applied to \(T\).

The validation target should be stated before choosing the summary. If each cell in the intended application is equally important, pooled cell accuracy may be relevant. If the goal is performance for a typical new donor, average donor-level performance gives each donor equal weight. These quantities can differ substantially when donors contribute different numbers of cells.

What Donor-Held-Out Validation Estimates

A donor-held-out result estimates performance under a particular target setting: new donors, with the tissue, assay, label definitions, and other study conditions represented by the validation donors. It does not guarantee performance for a different tissue, laboratory, assay, or population. Those changes may alter the relationship between expression profiles and cell types.

The design relies on several conditions. First, the held-out donors should be reasonably representative of the donors to which the model will be applied. Second, reference labels should be sufficiently reliable for the intended evaluation; a model cannot be judged cleanly against labels that are systematically wrong or inconsistent. Third, the test donors must not influence model fitting, feature selection, tuning, or other decisions that are being evaluated. Finally, the number of independent donors—not merely the number of cells—must be adequate for the intended claim.

A marker panel specified in advance from independent biological knowledge can be applied to held-out donors without training on their labels. By contrast, selecting markers after inspecting which genes separate labels in the full dataset lets test information influence the model. Similarly, scaling parameters, dimensionality-reduction loadings, integration steps, or probability calibration fitted using all donors can compromise a strict new-donor evaluation. In each case, ask whether information from a held-out donor would have been available when the model was supposedly deployed.

Worked Example: Cell-Weighted and Donor-Weighted Accuracy

Suppose a hypothetical test set contains three held-out donors. The model correctly annotates 90 of 100 cells from donor A, 12 of 20 cells from donor B, and 3 of 10 cells from donor C. Consider pooled cell accuracy and the mean of the three donor accuracies.

The donor accuracies are \(90/100=0.90\), \(12/20=0.60\), and \(3/10=0.30\). Pooled accuracy weights each cell equally:

$$ \frac{90+12+3}{100+20+10} = \frac{105}{130} = 0.8077. $$

The equal-donor average is:

$$ \frac{0.90+0.60+0.30}{3}=0.60. $$

The pooled result says that 80.77% of the 130 test cells were correctly annotated. The donor average says that the mean accuracy across these three donors was 60.00%, giving each donor equal weight. Neither is an arithmetic error: they answer different questions. Because donor A supplied most cells and had the highest accuracy, the cell-weighted result is much higher. Reporting only the pooled value could obscure poor performance on donors B and C.

Why Random Cell Splits Can Mislead

A cell-level random split usually places cells from the same donor in both training and test sets. To see how likely that overlap can be, suppose each cell is independently assigned to training with probability \(q=0.80\) and to testing with probability \(1-q=0.20\). Conditional on one particular cell being in the test set, suppose its donor contributed \(m=80\) cells in total. Each of the other 79 cells has probability 0.80 of being in training. The probability that at least one of them is in training is one minus the probability that none are:

$$ 1-(1-q)^{m-1} = 1-(0.20)^{79} \approx 1-6.045\times 10^{-56} \approx 1.000. $$

Thus, under this independent assignment scheme, a test cell is virtually certain to have at least one same-donor cell in training. This calculation establishes a high probability of donor overlap; it does not prove that every overlapping split will inflate accuracy by a fixed amount. The degree of optimism depends on how strongly donor-specific information affects predictions and on the task.

A random cell split may still be suitable for a different target, such as predicting additional cells from donors already represented in training. It is not a substitute for testing on new donors when new-donor generalization is the question. The split should reflect the intended deployment setting, not just produce a convenient test set.

Justification: If the intended test population consists of new donors, then a test cell should not share its donor with the training cells. A cell-level split does not enforce this condition. A donor-level split does: assigning each donor wholly to one partition ensures that no donor-specific profile is shared across training and test by construction.

Designing a Donor-Level Evaluation

A practical evaluation begins by deciding what information the model may use and what population it should generalize to. Then allocate whole donors to training, validation, and test groups. Fit all learned steps using only the donors allowed for that step. For repeated model comparisons, use grouped cross-validation, with donors—not cells—as the groups.

1
Specify the target.
State whether the goal is performance on new donors, additional cells from known donors, or another deployment setting. A new-donor claim calls for donor-disjoint evaluation.
2
Assign donors to groups.
Place every cell from each donor in exactly one partition for a given split. Check the donor identifiers directly to verify that training and test sets do not overlap.
3
Fit within the permitted data.
Estimate preprocessing, select features, tune parameters, and calibrate predictions without using test-donor information if the evaluation is meant to represent a fully unseen donor.
4
Evaluate and report at the relevant unit.
Compute test performance and show how it varies across donors. State whether a summary weights cells equally or donors equally, and report how many donors contributed.

When tuning model choices, an untouched test set is valuable: use training donors for fitting and validation donors for choices, then evaluate the selected procedure on test donors only. If data are limited, grouped cross-validation can rotate held-out donors, but decisions based on those same cross-validation results make the resulting score a model-selection estimate rather than an independent final test. A nested design can separate tuning from evaluation by performing donor-grouped tuning inside each outer training set and evaluating on the outer held-out donors.

The split also needs enough representation of relevant cell types. A donor-held-out fold may lack a cell type if that type is rare or absent in some donors. This is not a reason to put cells from the same donor on both sides. Instead, inspect donor-by-cell-type representation before finalizing folds, describe which classes can be evaluated, and avoid claiming performance for a class that the held-out data do not contain.

Worked Example: A Donor-Level Cross-Validation Summary

In a hypothetical leave-one-donor-out evaluation, a model is trained on all but one of four donors in turn. The held-out donor accuracies are 0.90, 0.80, 0.70, and 0.60. Treat these four donor scores as the units for a simple summary.

The mean donor accuracy is:

$$ \bar{x} = \frac{0.90+0.80+0.70+0.60}{4} = 0.75. $$

The deviations from the mean are \(0.15\), \(0.05\), \(-0.05\), and \(-0.15\). Their squared deviations sum to \(0.0225+0.0025+0.0025+0.0225=0.0500\). The sample standard deviation across donors and the corresponding standard error of the mean are:

$$ s = \sqrt{\frac{0.0500}{4-1}} = 0.1291, \qquad SE = \frac{s}{\sqrt{4}} = 0.06455. $$

The average accuracy across the four held-out donors is 75.00%, and the observed donor-to-donor standard deviation is 12.91 percentage points. The standard error is a descriptive measure of uncertainty in the mean across donors under the usual independent-donor sampling interpretation. With only four donors it is imprecise; many cells per donor do not turn four independent donors into a large donor sample. Also, the fold models have overlapping training sets, so this calculation is not a complete account of all uncertainty in the model-building procedure.

Diagnostics, Alternatives, and Limitations

Before interpreting a score, verify the design rather than relying on the name of the split procedure. Check that donor identifiers are disjoint across partitions, that no cell is duplicated across them, and that all fitted preprocessing and selection steps obey the stated boundary. Review donor-level results for a pattern in which one or two donors dominate the pooled score. Also check whether some held-out donors have cell types absent from training; low performance in that setting may reflect missing training support, not merely ordinary variation among familiar classes.

The main alternative, a random cell-level split, is easier to implement and may answer a known-donor prediction question, but it usually does not estimate generalization to unseen donors. A single donor holdout is transparent but can be highly dependent on which donor was chosen. Grouped \(K\)-fold cross-validation uses several held-out donor groups and can show variation across folds, though its estimates remain limited by the available donors and by any tuning performed on those results. An external cohort provides a stronger test of transport to a distinct data collection when it matches the intended application, but may differ in protocol or population in ways that complicate interpretation.

Donor-held-out validation is not a universal cure for distribution mismatch. If donors were all recruited under one narrow condition, holding them out does not establish performance in a different condition. Nor does the procedure by itself diagnose which cell types are confused or explain why predictions fail; those questions require examining prediction errors and relevant class-level behavior. The central contribution is a defensible separation between donors used to develop the method and donors used to assess its new-donor performance.

Common mistake: “The test set contains thousands of cells, so the validation is precise even though there are only a few donors.” The correction is that cells within a donor share biological and technical context. For a claim about new donors, the number and diversity of held-out donors determine how broadly the result can be generalized; a large cell count within a few donors does not replace independent donor replication.

Check Your Understanding

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

  1. A study has 12 donors and aims to annotate cells from new donors. What must be kept together when forming training and test sets?
  2. Under an independent 80% training assignment, a donor contributes 10 cells. Given that one cell is in the test set, what is the probability that at least one of the other nine cells is assigned to training?
  3. Two held-out donors have accuracies 0.80 and 0.40. What is their equal-donor mean accuracy? Why might pooled cell accuracy differ?
  4. Why can fitting a feature-selection step using all donors compromise a donor-held-out evaluation?
  5. What does a donor-held-out score fail to establish if all study donors came from the same narrow clinical population?

Solutions. (1) Keep every cell from each donor in one partition, so no donor appears in both training and test. (2) The probability is \(1-(1-0.80)^9=1-(0.20)^9=1-5.12\times10^{-7}=0.999999488\), approximately 1.000. (3) The equal-donor mean is \((0.80+0.40)/2=0.60\), or 60%. Pooled accuracy weights donors by their numbers of test cells, which may be unequal. (4) Feature selection has then used information from donors treated as held out, so the evaluation no longer represents a procedure developed without those donors. (5) It does not establish performance in a different clinical population or other setting not represented by the donors; such transport requires evidence from data relevant to that target.

Clinical Biostats