Chapter 8

Bias, variance and validation

A learning procedure is random because its training sample is random. Validation estimates how a fitted procedure performs beyond that sample. Use a separate final test set so model selection does not consume the evidence intended for evaluation.

8.1 Squared-error decomposition

At a fixed input x\mathbf x, let the response be y=f∗(x)+εy=f_*(\mathbf x)+\varepsilon, with E[ε∣x]=0E[\varepsilon\mid\mathbf x]=0 and Var⁡(ε∣x)=σε2(x)\operatorname{Var}(\varepsilon\mid\mathbf x)=\sigma_\varepsilon^2(\mathbf x). A training dataset DD produces prediction f^D(x)\hat f_D(\mathbf x). The test noise is independent of DD.

ChangeUsual bias trendUsual variance trend
Increase ridge penaltyUpDown
Increase nearest-neighbour kkUpDown
Increase tree depth or model flexibilityDownUp
Increase independent training dataNot a universal monotonic ruleUsually down

These are useful trends, not pointwise guarantees for every dataset. Underfitting gives poor training fit as well as poor validation fit. Overfitting gives a strong training fit but a substantial validation gap.

8.2 Holdout, k-fold and leave-one-out

Past papers · DA 2024–2026 (3 papers): 1 question, 1 mark

Split off final test data first. Let ndevn_{\rm dev} be the remaining development-set size and KK the number of validation folds. Every development observation is held out once in one KK-fold run.

Choose hyperparameters by validation score, refit on all development data, and evaluate the final test set once. With MM candidates and RR repetitions of KK-fold CV, the selection stage requires MRKMRK fits when each candidate is fitted independently. Final refitting adds one fit.

MethodUse and caution
HoldoutOne train/validation split; estimate depends on the split
KK-foldModerate training cost; each observation validates once
LOONearly full-size training subsets; expensive and highly overlapping
Stratified foldsApproximately preserve class proportions
Grouped foldsKeep observations from one entity together
Forward time splitTrain on the past, validate on later observations
Nested CVInner folds select settings; outer folds estimate the selection procedure's performance

LOO often has smaller training-size bias than a small-KK estimate; its highly correlated fits can make the error estimate variable. There is no universal claim that LOO has the lowest estimator variance. All imputation, scaling, feature selection and PCA fitting must occur within each training fold. Transform validation data using that fold's fitted transformation.

Last-minute recall

  • Bias and variance average over training datasets.
  • Irreducible test noise remains even with the true regression mean.
  • Validation selects settings; the final test evaluates the selected procedure.
  • LOO fold count equals development-set size, not number of features or classes.
  • Fit preprocessing inside each fold.
  • Stratification does not solve dependence between repeated observations of one entity.
  • Compare CV procedures using the same loss and averaging convention.

Revise offline: the whole Machine Learning handbook as one PDF

42 pages · 1.8 MBFree to read online. Sign in to download the PDF.We save the handbook, version and request time in My downloads. Privacy policy

All chapters · Corrections