A binary classification population has positive-class proportion p∈(0,1), and a fixed classifier has true error rates e1 on positives and e0 on negatives. How do the bias and variance of the validation error estimate compare between m i.i.d. validation draws (simple random sampling) and m stratified validation draws (m1=mp positives and m0=m(1−p) negatives, assumed integers), and when does stratification reduce variance the most?

Foundations, Model selection
Level L4 Advanced. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can derive the exact variance reduction of stratified validation using the law of total variance and interpret it for imbalanced classification.

Key idea

Both simple random and stratified validation are unbiased for the true error μ=pe1+(1−p)e0, but stratification removes the between-class variance term p(1−p)(e1−e0)2m caused by random fluctuations in the validation class ratio.

Steps

  1. Define the population error and both estimators: let Z=I[y^(X)≠Y]∈{0,1} be the 0–1 error indicator of the fixed classifier, with E[Z∣Y=1]=e1 and E[Z∣Y=0]=e0. The true population error is μ=E[Z]=pe1+(1−p)e0.
  2. Analyse simple random sampling (SRS): e^SRS=1m∑i=1mZi for m i.i.d. draws from (X,Y). It is unbiased (E[e^SRS]=μ) with variance Var⁡(e^SRS)=1mVar⁡(Z). Apply the law of total variance conditioning on Y∈{0,1}: Var⁡(Z)=E[Var⁡(Z∣Y)]+Var⁡(E[Z∣Y])=[pe1(1−e1)+(1−p)e0(1−e0)]+p(1−p)(e1−e0)2, because E[Z∣Y] takes values e1 with probability p and e0 with probability 1−p.
  3. Analyse stratified sampling: draw m1=mp positives and m0=m(1−p) negatives independently, compute class error rates e^1 and e^0, and form e^strat=pe^1+(1−p)e^0 (which equals the overall average 1m(m1e^1+m0e^0)). It is also unbiased: E[e^strat]=pe1+(1−p)e0=μ.
  4. Compute the stratified variance using independence between the two class strata: Var⁡(e^strat)=p2e1(1−e1)mp+(1−p)2e0(1−e0)m(1−p)=1m[pe1(1−e1)+(1−p)e0(1−e0)].
  5. Take the difference: Var⁡(e^SRS)−Var⁡(e^strat)=p(1−p)(e1−e0)2m≥0.
  6. Interpret: stratification never increases variance (for proportional allocation) and achieves the largest absolute variance reduction when both ∣e1−e0∣ and p(1−p) are large (under strong class imbalance with small p and e0≈0, the share of the variance it removes is only about e1, so it matters most when the positive-class error is large). In k-fold CV, stratified folds keep every fold's class ratio near p, preventing unlucky folds with almost no positive examples.

Common mistakes

How long your answer should be

One page; 8–10 minutes.

Last checked on 4 December 2026.

Read this

Previous in Foundations: Suppose you use a train/validation/test split to choose among M=100 candidate models (with 0–1 loss) on a validation set of size nval. Using Hoeffding's inequality and the union bound, how large must nval be so that simultaneously all M validation errors are within ϵ=0.05 of their true errors with probability at least 95%, why do large datasets not need 20\% validation splits, and should you retrain on train+validation before testing?
Next in Foundations: How is Schwarz's Bayesian Information Criterion BIC=kln⁡n−2ℓ(θ^MLE) derived from the Bayesian marginal likelihood p(D∣M)=∫Rkp(D∣θ,M) p(θ∣M) dθ using Laplace's approximation?