Tutorials › Multi-Omics Data Integration › Uncertainty In Held-Out Performance Estimates

Prediction Models and Data Leakage · Tutorial 420 of 597

Uncertainty In Held-Out Performance Estimates

Construct and interpret held-out performance intervals by resampling the independent units that represent the target population.

Advanced 10 min read

What You'll Learn

  • Distinguish uncertainty from sampling held-out units from uncertainty due to model training.
  • Choose the resampling unit to match the independent unit in the study design.
  • Construct bootstrap standard errors and percentile intervals for performance metrics.
  • Explain how within-unit dependence makes observation-level intervals too narrow.
  • Recognize when small samples, few cohorts, or population shift limit interval reliability.

Why a Held-Out Score Needs an Uncertainty Interval

A held-out test set gives an estimate of how a fixed prediction pipeline performs on new units from a target population. Its score is not usually the population performance itself: a different sample of subjects could produce a different accuracy, area under the ROC curve, or other metric. An uncertainty interval describes this test-sample variability. It does not measure every source of uncertainty in a prediction study, and it cannot correct a test set that has already been reused to choose a model or threshold.

In multi-omics studies, the row used for analysis is not always the independent unit. A subject may contribute multiple specimens, visits, or technical measurements; subjects may also be grouped within cohorts or sites. The interval must reflect the sampling structure and the population to which performance is meant to generalize. Resampling individual rows when those rows are correlated can make an interval substantially too narrow.

Definition: A held-out performance estimate is a metric computed from predictions and outcomes on data not used to fit, tune, or select the evaluated pipeline. A resampling unit is the independently sampled unit relevant to the target population, such as a subject or a cohort. A bootstrap interval is formed by repeatedly sampling these units with replacement, recomputing the metric, and using quantiles of the resulting values to represent sampling uncertainty.

What the Interval Conditions On

For a basic held-out bootstrap, regard the prediction pipeline as fixed. The observed test units are treated as a sample from the target population, and each bootstrap replicate is a new sample of the same size drawn with replacement from those units. Calculate the metric anew in every replicate. For a metric such as accuracy, this means recalculating the fraction correct; for AUC, it means recalculating AUC from the resampled predictions and outcomes.

This procedure estimates variation from which independent test units happened to be observed, conditional on the fitted pipeline and the chosen evaluation design. It does not, by itself, include variation from fitting a different training set, selecting different features, tuning different hyperparameters, or choosing a different threshold. Those questions require an evaluation procedure that repeats the relevant training and selection steps. A held-out interval also does not remove bias from test-set reuse or guarantee performance under a shifted population.

The usual bootstrap interpretation relies on a representative sample of independent units from the target population, a metric defined in advance, and enough units for the resampled distribution to approximate the sampling distribution. The unit-level bootstrap preserves all records belonging to a sampled unit. If the test design fixed the number of cases and controls, a stratified bootstrap may instead resample within outcome groups; its inference is conditional on that design. The resampling scheme should match the sampling process and the performance target.

Constructing a Unit-Level Bootstrap Interval

1
Identify the target and unit.
Specify the population, metric, and independently sampled unit. If subjects contribute repeated records, resample subjects and retain all their records together.
2
Resample with replacement.
For each of \(B\) replicates, draw the original number of independent units with replacement. Repeated draws of one unit appear more than once in that replicate.
3
Recompute the metric.
Calculate the chosen performance metric on each resampled set. If the metric depends on all predictions and outcomes jointly, recompute it from those data rather than averaging row-level summaries.
4
Summarize the bootstrap distribution.
The standard deviation of the \(B\) bootstrap values estimates the bootstrap standard error. The 2.5th and 97.5th percentiles give a 95% percentile interval.

A 95% percentile interval is a procedure intended, under its assumptions, to cover the target performance in repeated samples about 95% of the time. It does not mean there is a 95% probability that a fixed population performance lies inside this particular interval. The empirical endpoints also have Monte Carlo error when \(B\) is finite, so use enough replicates for stable quantiles and check that repeated runs give similar results.

Worked Examples

Worked Example: Accuracy From Independent Subjects

Suppose a frozen classifier is evaluated on 40 independent hypothetical subjects. It classifies 31 correctly, so the observed accuracy is \(31/40=0.775\), or 77.5%. Assume the subjects are sampled independently from the target population and the test set has not been used for model selection. A subject-level bootstrap resamples 40 subjects at a time.

In each bootstrap replicate, the number of correct predictions follows a binomial distribution with 40 draws and success probability equal to the observed fraction, 0.775, under the empirical bootstrap distribution. The bootstrap standard error is therefore approximately

$$ SE_{\text{boot}} \approx \sqrt{\frac{0.775(1-0.775)}{40}} = \sqrt{0.004359} = 0.0660. $$

For a large number of bootstrap replicates, the 2.5th and 97.5th percentiles of the bootstrap accuracy are approximately \(26/40=0.650\) and \(36/40=0.900\). Thus, the percentile interval is about 65.0% to 90.0%. It describes uncertainty in the accuracy estimate due to sampling 40 subjects, conditional on this fitted classifier and the stated sampling assumptions.

Worked Example: Repeated Records Must Stay Together

Consider 20 hypothetical subjects, each with five records. A fixed classifier gets all five records correct for 16 subjects and all five wrong for four subjects. There are 80 correct predictions among 100 records, so pooled accuracy is \(80/100=0.800\). The independent units are the 20 subjects, not the 100 records.

If the records were incorrectly treated as 100 independent Bernoulli outcomes, the estimated standard error would be

$$ SE_{\text{row}} \approx \sqrt{\frac{0.800(1-0.800)}{100}} = 0.0400. $$

But each subject's five correctness indicators are perfectly correlated in this constructed example. A subject-level bootstrap samples 20 subjects and keeps each subject's five records together. If \(K^*\) is the number of correctly classified subjects in a replicate, then \(K^*\) has the empirical bootstrap distribution \(\mathrm{Binomial}(20,0.8)\), and replicate accuracy is \(K^*/20\). Its bootstrap standard error is

$$ SE_{\text{subject}} \approx \sqrt{\frac{0.800(1-0.800)}{20}} = 0.0894. $$

The exact percentile quantiles for this discrete bootstrap distribution are approximately \(12/20=0.600\) and \(19/20=0.950\). The subject-level interval is therefore about 60.0% to 95.0%, much wider than an interval based on 100 supposedly independent records. Here the observation-level calculation understates uncertainty because it counts repeated, dependent records as if they supplied 100 independent pieces of information.

Worked Example: Uncertainty Across Cohorts

Suppose performance is intended to describe an average cohort, rather than an average patient in a pooled population. Four hypothetical held-out cohorts have accuracies 0.60, 0.70, 0.80, and 0.90. The macro-average, which gives each cohort equal weight, is

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

The independent units for this target are cohorts. A cohort bootstrap draws four cohort accuracies with replacement and averages them. The sample standard deviation across the four observed cohort accuracies is

$$ s = \sqrt{\frac{(-0.15)^2+(-0.05)^2+(0.05)^2+(0.15)^2}{4-1}} = \sqrt{0.01667} = 0.1291. $$

The bootstrap standard error of the average is \(s/\sqrt{4}=0.0645\). The exact percentile interval from the empirical resampling distribution is approximately 0.650 to 0.850. This interval reflects variation in which cohorts are represented, under the assumption that the observed cohorts are informative independent draws from a cohort population. With only four cohorts, that assumption is difficult to assess and the interval is fragile. Also, the equal-cohort average answers a different question from pooled accuracy, which weights cohorts according to their numbers of subjects.

Why Observation-Level Intervals Can Be Too Narrow

The repeated-record example has a general explanation. Let there be \(G\) independent clusters, each with \(m\) observations, and let \(Y_{gj}\) be a binary indicator that observation \(j\) in cluster \(g\) is correctly classified. Suppose each indicator has variance \(p(1-p)\), and any two observations within a cluster have correlation \(\rho\). The pooled accuracy is the mean of \(Gm\) indicators. Its variance is

$$ \begin{aligned} \operatorname{Var}(\bar{Y}) &= \frac{1}{(Gm)^2} \left[Gm\,p(1-p)+Gm(m-1)\rho p(1-p)\right] \\ &= \frac{p(1-p)}{Gm}\left[1+(m-1)\rho\right]. \end{aligned} $$

The factor \(1+(m-1)\rho\) is the variance inflation relative to treating all \(Gm\) records as independent. If \(\rho>0\), the observation-level variance is too small; if \(\rho=1\), the inflation factor is \(m\), as in the repeated-record example. A unit-level bootstrap retains within-cluster dependence rather than silently setting it to zero.

Diagnostics, Alternatives, and Limitations

Before interpreting an interval, check whether the resampling unit matches the intended generalization. If the goal is performance on new subjects from the same sites, subject-level resampling may be appropriate, while keeping site membership intact if that is part of the sampling structure. If the goal is performance on new sites, resampling subjects within the observed sites does not represent site-to-site variation; the site or cohort is the relevant unit, and a small number of sites limits what can be learned. These choices are about the target population, not merely computational convenience.

Inspect the bootstrap distribution, not only its endpoints. Repeated values, skewness, or extreme replicates can occur, especially with small samples or bounded metrics. For AUC or other metrics requiring both outcome classes, a replicate that contains only one class cannot produce a defined value; frequent undefined replicates indicate that the test sample is too small for the chosen ordinary bootstrap to give a dependable interval. Do not silently discard such replicates without explaining how that changes the procedure. A stratified resampling design may be justified when class counts were fixed, but it answers a conditional question.

Alternatives include analytic intervals for simple metrics under suitable independent-sampling assumptions, and model-based variance estimates that explicitly represent clustering. These can be useful when their assumptions fit the design; they are not automatic repairs for dependence. The bootstrap is flexible for complex metrics, but it is not reliable simply because it can be run. In particular, few independent units, strong population shift, test-set reuse, or a metric that changes with threshold selection can undermine interpretation. Comparing two models on the same held-out subjects calls for accounting for their paired predictions; that is a separate question from estimating uncertainty for one model's score.

Common Pitfall

Key takeaway: “There are 500 measurements, so I should bootstrap 500 rows” is not valid when those measurements come from, for example, 50 subjects with repeated samples. The correction is to resample the 50 independent subjects, keeping each subject's measurements and predictions together. The interval then reflects the number of independent units that support generalization.

Check Your Understanding

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

  1. A test set has 60 independent subjects and 120 specimens, two per subject. For uncertainty about performance on new subjects from the same population, what should be resampled?
  2. In a subject-level bootstrap, why are all records from a selected subject retained together?
  3. A model has held-out accuracy 0.70 on 100 independent subjects. Give the plug-in binomial standard error calculation.
  4. What source of uncertainty does a bootstrap of a fixed held-out test set omit?
  5. Four cohorts are used to estimate performance on new cohorts. What limitation should be emphasized when interpreting a cohort-bootstrap interval?

Solutions. (1) Resample 60 subjects, retaining both specimens and their associated predictions and outcomes in each draw. (2) The subject is the independent unit; keeping its records together preserves within-subject dependence. (3) \(SE\approx\sqrt{0.70(0.30)/100}=\sqrt{0.0021}=0.0458\), or about 4.58 percentage points, under independent-subject Bernoulli assumptions. (4) It omits variation from fitting or selecting a different model or pipeline; it is conditional on the fitted pipeline. (5) Four independent cohorts provide very limited information about between-cohort variation, so the interval may be unstable and its coverage unreliable.

Clinical Biostats