2.6.1 · D3Model Evaluation & Selection

Worked examples — Bias-variance tradeoff

2,479 words11 min readBack to topic

This is the worked-examples deep dive for the Bias-Variance Tradeoff. The parent note derived the decomposition

Here we make it concrete with numbers. Before we start, let me re-anchor every symbol in plain words so you never meet an unexplained mark.

Every example below plugs real numbers into these three buckets.


The scenario matrix

Bias-variance is not one formula; it is a spectrum of regimes. Every model you ever build lands in exactly one of these cells. This page works one example per cell so you never meet a case blind.

Cell Regime Bias Variance Where you meet it
A Model too simple (underfit) High Low constant / linear on curved data
B Model too complex (overfit) ~0 Very high degree-9 poly on 10 points, 1-NN
C Just-right complexity Low Low-ish the U-curve minimum
D Degenerate low end (, constant) Max Zero predict-the-mean baseline
E Degenerate high end (interpolation) 0 Max model passes through every point
F Limiting input: (infinite data) unchanged asymptotic behaviour
G Effect of noise (irreducible floor) unchanged unchanged error can't go below
H Regularization dial (trade bias up for variance down) ridge / L2
I Real-world word problem forecasting sales
J Exam twist (compute the three terms exactly) closed-form check

We now sweep the whole table. Figure 1 is your map: the U-shaped total-error curve with each cell marked.

Figure — Bias-variance tradeoff

Example 1 — Cells A & D: the constant model (max bias, zero variance)

Forecast: Guess now — will variance be big or tiny for a model that ignores its data almost entirely?

  1. Find the constant the model settles on. Using oracle knowledge, its value is the mean of the true curve: Why this step? We deliberately fix from the noise-free (not from data) so that no dataset can shift it — that is what makes the variance exactly zero for this teaching case. Averaging a full sine cycle gives .

  2. Bias at . The true value there is . The average prediction is . Why this step? Bias is average prediction minus truth — here a full unit off. That is cell A: maximal systematic miss.

  3. Variance. Because was pinned by oracle knowledge (not by any noisy sample), it never changes across datasets: Why this step? Zero variance is the signature of cell D: with frozen independent of the data, the model is perfectly stable but blind.

Verify: Bias + Var . Sanity: a model that always says at a point where truth is should be off by exactly , and never wobble. ✔


Example 2 — Cells B & E: degree-9 polynomial interpolating 10 points

Forecast: If the fit hits every point exactly, what is its bias at those points? And what happens when the noise changes?

  1. At a training point, the prediction equals the observed . So . Why this step? Interpolation means "copy the data". This is cell E: forced to pass through everything.

  2. Bias at . Average over datasets: . Why this step? On average the noise cancels, so the interpolator is unbiased at data points — classic cell B: near-zero bias.

  3. Variance at . , so Why this step? Since the prediction copies the noise directly, its scatter across datasets equals the noise's own scatter, . And between data points a degree-9 curve swings enormously (Runge oscillation), so its variance there is many times . Figure 2 shows five fits on five noise draws diverging.

Verify: At : Bias+Var . With (so ), that's . The overfit model's point error equals pure noise — it has learned nothing but the noise. ✔

Figure — Bias-variance tradeoff

See Overfitting and Underfitting and Model Capacity for why 10 parameters on 10 points is the danger line.


Example 3 — Cell C: the just-right degree-3 fit (the U-minimum)

Forecast: Complexity climbs left to right. Bet on which one wins before summing.

  1. Add the three buckets for each model (total BiasVar):

    • Degree 1:
    • Degree 3:
    • Degree 9: Why this step? The decomposition says total error is just the sum — no cross terms survive.
  2. Pick the minimum. Degree 3 gives , the smallest. That is cell C, the bottom of the U. Why this step? Neither extreme wins: degree 1 pays in bias, degree 9 pays in variance.

Verify: . The bottom sits at moderate complexity — exactly the U-shape the parent note predicted. ✔ Use Cross-Validation or Learning Curves to find this minimum in practice.


Example 4 — Cell F: infinite data limit ()

Forecast: Common belief: "with enough data, error → 0." True or false here?

  1. Variance as grows. With parameters, : Why this step? Each extra point dilutes any single point's influence, so scatter shrinks. This is cell F.

  2. Bias stays put. A straight line cannot bend into a sine no matter how many points. The best line still misses the curvature, so Bias stays at its floor (say ). Why this step? Bias is a property of the model class, not the sample size.

Verify: As , total error , not zero. More data helps variance only; the tradeoff persists. ✔ (This is Mistake 1 from the parent note made numeric.)


Example 5 — Cell G: the irreducible floor

Forecast: Perfect model — surely zero error?

  1. Plug into the decomposition with Bias , Var : Why this step? The term is measurement noise living in itself, not in the model. No model can predict a coin flip's specific outcome. This is cell G.

  2. Interpret. Since , the standard deviation is , the RMS floor: predictions cannot beat typical error on average.

Verify: Total ; a perfect predictor still eats the noise. If someone reports error below , they measured on the training set (data leak) — see Train-Validation-Test Split. ✔


Example 6 — Cell H: regularization dials bias up, variance down

Forecast: is no regularization. Will the best be , or something positive?

  1. Write the total and differentiate. Why this step? The minimum of a smooth U is where its slope hits zero — that's why we use the derivative, the tool that reads "instantaneous steepness".

  2. Set and solve numerically. Trying : (too small). : (too big). : . : . So . Why this step? Positive proves some regularization helps: cell H.

  3. Confirm the trade. As rises from 0: bias grows, variance shrinks. The optimum accepts a little bias to buy a big variance cut. Why this step? Reading the two curves against each other is the whole point of the exercise — it shows the trade is a genuine exchange, not a free lunch.

Read Figure 3 now. The cyan Bias curve climbs from zero as grows; the amber Variance curve falls steeply from at . Their sum, the white Total curve, dips to a clear minimum marked by the amber dot at . Notice how far below the starting height that minimum sits — that vertical drop is the benefit of regularizing.

Verify: At : . Compare : . Regularizing cut error from to . ✔ More in Regularization Techniques.

Figure — Bias-variance tradeoff

Example 7 — Cell I: real-world word problem (ensemble averaging)

Forecast: Averaging 10 models — which term drops, bias or variance?

  1. Bias of the average. Each tree averages to the same biased value, so their mean has the same bias: Bias still. Why this step? Averaging identical systematic misses doesn't fix the miss.

  2. Variance of the average. Independence gives Why this step? Uncorrelated wobbles partly cancel — this is exactly what Ensemble Methods (bagging) exploits. Cell I.

  3. Total. BiasVar vs. single tree . Why this step? Summing the buckets lets us compare the ensemble against the single tree on one honest number.

Verify: Ensemble error single tree — a cut, all from variance reduction. Units: sales, so RMS drops from to units. ✔


Example 8 — Cell J: exam twist (compute all three terms exactly)

Forecast: The sample mean is famously "unbiased" — so is one of the three terms exactly zero?

  1. Bias. . Why this step? Averaging unbiased observations stays unbiased — cell A/D's opposite: no systematic miss.

  2. Variance. For i.i.d. terms, . Why this step? This is the rule from Example 4, now exact.

  3. Total expected error (comparing prediction to a fresh noisy ): Why this step? The final is the noise in the new observation we're judged against — the irreducible floor of cell G.

Verify: Total ; note the estimator's own MSE is BiasVar, and the extra is the noise in the target. Doubling to would halve the variance to but leave bias and floor . ✔ This connects to sample-complexity ideas in PAC Learning Theory.


Recall Quick self-test

Constant model on a sine has which extreme profile? ::: Maximum bias, zero variance (cells A & D). A degree-9 poly through 10 points has what bias at the training points? ::: Zero (it copies , and noise averages out). Does infinite data remove bias? ::: No — bias is a property of the model class; only variance (cell F). Regularization trades what for what? ::: Raises bias, lowers variance; optimal (cell H). Averaging 10 independent models divides which term by 10? ::: Variance, not bias (cell I). Can total error drop below ? ::: No, that's the irreducible floor (cell G).