2.6.12 · D4Model Evaluation & Selection

Exercises — Learning curves analysis

3,239 words15 min readBack to topic

This page is a self-testing worksheet. Every problem has its full solution hidden inside a collapsible Solution callout — try first, then reveal. Problems climb from just recognising a shape (L1) up to designing a full diagnostic strategy (L5).

Before you start, one shared vocabulary reminder from the parent note Learning curves analysis:

We will use one fixed rule of thumb throughout so grading is unambiguous:


Level 1 — Recognition

Goal: read a curve or a pair of numbers and name the situation. No arithmetic beyond a subtraction.

Exercise L1.1

A learning curve shows, at the final training size :

  • , (units: dollars squared). Both curves are flat (plateaued) for the last several points.

What is the diagnosis?

Recall Solution — L1.1

Step 1 (WHAT). Compute the gap: . Step 2 (WHY). Our rule says: small gap and both values high (48–51 is far above a zero-ish floor) and plateaued. That is the signature of the left panel in the figure above. Diagnosis: high bias (underfitting). Fix: add model capacity — higher polynomial degree, more features, or less regularization. Do not collect more data.

Exercise L1.2

At : , (percent error). The training curve is flat near zero; the validation curve is still sloping downward at the right edge.

Name the pattern.

Recall Solution — L1.2

Gap — large. Training error near the floor. Validation still falling. This is the right panel: high variance (overfitting). Fix: more training data, more regularization, or lower model complexity. Because the orange curve is still dropping, more data will help here (unlike L1.1).

Exercise L1.3

At : , (percent). Both plateaued, both low.

Name the pattern.

Recall Solution — L1.3

Gap (small), and both values are low and plateaued. Neither "high & together" (bias) nor "low with big gap" (variance): this is the good fit case. Ship it, or push complexity only if is unacceptable for the task.


Level 2 — Application

Goal: plug numbers into the plateau/gap formulas from the parent note and read off a limit.

Exercise L2.1

The parent note models high-bias training error as where is the noise variance — a fixed number measuring how noisy the data is. Given and , compute at , , and .

Recall Solution — L2.1

WHY this formula. The term is a finite-sample bonus: with very few examples the model can partly fit the noise, so its measured training error sits below the true floor by an amount . Wait — it sits above: the formula adds , so at small the measured training error is inflated and it decreases toward the floor as grows.

  • .
  • .
  • . Direction check. As written, is monotonically decreasing in : the numbers fall , and approaches from above. (The parent note describes the empirical high-bias curve rising because it uses a much smaller and plots the region where the rise is visible; the algebra of this exact formula with these numbers decreases — trust the algebra.) The limit is what matters here: .

Exercise L2.2

High-variance validation error follows where is the irreducible error (the noise floor no model can beat), is a positive variance-scale constant (how strongly overfitting inflates the error), and is a complexity constant (larger for more complex models). With , , : find the gap at and , assuming throughout.

Recall Solution — L2.2

WHY. For a complex model, training error already hits the irreducible floor , so the entire gap is the variance penalty .

  • .
  • . The gap shrinks as data grows fivefold — concrete proof that more data helps a high-variance model.

Exercise L2.3

Using the same shape (with , ), how many training examples are needed to bring the gap down to ?

Recall Solution — L2.3

Set . Interpretation for sample-size planning: halving the gap requires doubling the data — diminishing returns baked into the law.


Level 3 — Analysis

Goal: take a raw table of numbers, decide the pattern, and justify each move.

Exercise L3.1

Diagnose this run (units: , degree-10 polynomial on housing data):

10 30 50 70 100
0 1 2 5 8
80 60 45 35 28
Recall Solution — L3.1

Step 1 — training curve. Rises slowly : stays near the floor. Complex model memorises easily. Step 2 — validation curve. Falls fast and is still dropping at (last step is a big -unit drop). Step 3 — gap at the end. : large. Diagnosis: high variance. Because the orange curve is still descending, collecting more data is a valid fix (unlike a bias problem). Also viable: raise regularization or lower degree.

Exercise L3.2

Same problem, degree-3 fit:

10 30 50 70 100
5 12 15 16 17
15 18 19 18 18

Diagnose, and compute the final gap.

Recall Solution — L3.2

Final gap (small). Both curves flattened around and both sit low (well under a zero-ish floor's danger zone — a gap of is negligible). Diagnosis: good fit. Training rose to meet validation, both plateaued, tiny gap. This is exactly the convergence we want.

Exercise L3.3

A neural network reports accuracies (higher = better), not errors:

  • 500 images: train acc , val acc .
  • 5000 images: train acc , val acc .

Convert to errors, compute both gaps, and state what the change tells you.

Recall Solution — L3.3

WHY convert. Our whole framework is written in errors (lower = worse). Error .

  • At 500: , , gap . Training near floor + huge gap high variance.
  • At 5000: , , gap . Reading the trend. More data cut the gap and raised validation accuracy . That downward-moving validation error is the fingerprint of a variance problem that data is fixing. Remaining gap = mild overfitting; add light regularization if you need more.

Level 4 — Synthesis

Goal: combine diagnosis with an action plan, or reason across two models at once.

Exercise L4.1

Your linear model gives , , both plateaued (bias). A colleague proposes spending a month labelling 100× more data. Predict the new errors and state whether the plan is worth it.

Recall Solution — L4.1

Model it. High bias means regardless of — the correction is already negligible once curves plateaued. Prediction after 100× data: , . Essentially unchanged. Verdict: the month is wasted. The bottleneck is model capacity, not data. Spend the effort on higher complexity / better features instead. This is the parent note's headline warning: "more data always helps" is false for high bias.

Exercise L4.2

Two candidate models on the same 1000-example dataset:

Model A
Model B

Which single fix helps A the most, and which helps B the most? Which model would you deploy today if you cannot collect more data?

Recall Solution — L4.2

Model A: gap , train near floor high variance. Best fix without new data: stronger regularization / lower complexity. Model B: gap , both moderately high high bias. Best fix: more capacity / features. Deploy today: compare the honest number, : A gives error, B gives . Deploy B — it generalises better right now even though its training score looks worse. Never pick a model on training error; pick on validation error.

Exercise L4.3

For the high-variance Model A above ( with fitted so that gap at , i.e. ), how many examples would you need to shrink the gap to ? Is that realistic?

Recall Solution — L4.3

. Solve . So examples (2.8× current) gets the gap to — often realistic. But to reach gap you'd need (14× data): the law makes the last bit expensive. Combine data with regularization to reach it cheaper.


Level 5 — Mastery

Goal: full end-to-end strategy, including choosing what to plot, in what order, and when to stop.

Exercise L5.1

You inherit a model with unknown behaviour and a fixed budget: you may take exactly one of {collect 10× data, add L2 regularization, double model capacity}. Design the minimum experiment that tells you which action to take, and give the decision rule as a small flowchart.

Recall Solution — L5.1

Minimum experiment. Plot the learning curve once on your current data: train the model on increasing fractions ( of what you have) and record and $J_{val}$ at each. This single plot reveals both height and gap — no extra data needed yet. Decision logic:

flowchart TD
  A["Plot learning curve on current data"] --> B{"Both errors high and gap small"}
  B -->|yes| C["High bias: double capacity"]
  B -->|no| D{"Train low and gap large and val still dropping"}
  D -->|yes| E["High variance: collect 10x data"]
  D -->|no| F{"Gap large but val flat"}
  F -->|yes| G["High variance saturated: add regularization"]
  F -->|no| H["Good fit: ship it"]

Why this order. We test bias first (cheapest to rule out — no data needed), then split the variance case by whether the validation curve is still falling: if it is, data pays off; if it has flattened, extra data won't and regularization is the lever.

Exercise L5.2

Formalise the "still dropping vs flat" test used above. Given the last two validation points and with , write a quantitative condition for "more data is worth collecting," and apply it to L3.1's final points , with a target gain of at least units per examples.

Recall Solution — L5.2

Condition. Estimate the local slope "Worth it" if the projected gain over your next data batch meets your threshold : Apply. slope units/example. Over more examples the projected gain is . Yes — collect more data. The validation curve is far from flat, so the investment clears the bar comfortably.

Exercise L5.3 (capstone)

Combine everything. A decision tree gives:

  • Depth 1: , .
  • Depth 20: , .

(a) Diagnose each. (b) Argue that some intermediate depth exists that beats both on , and describe how learning curves + a complexity sweep locate it. (c) State the expected shape of the good-fit curve you're hunting for.

Recall Solution — L5.3

(a) Depth 1: gap , both high high bias (tree too shallow to split the classes). Depth 20: gap , train near floor high variance (tree memorises). Depth directly controls capacity, so it slides us along the bias–variance axis. (b) As depth increases , bias falls (validation improves from ) but variance rises (gap opens). Validation error therefore first decreases then increases — a U-shape — so its minimum lies at some intermediate depth, strictly below both endpoints' (both endpoints are , and the U-minimum is below the higher shoulder). To find it: sweep depth , and for each plot a learning curve; pick the depth whose validation error is lowest and whose gap is acceptably small.

Figure — Learning curves analysis
(c) The winning depth's learning curve looks like the parent's good-fit picture: training error rises modestly, validation error falls, the two converge to a low value with a small persistent gap, both plateaued.


Recall Self-test: one-line reveals

Height of both curves tells you which failure mode ::: bias (high = high bias) The gap between the curves tells you which failure mode ::: variance (large = high variance) High bias, so more data will... ::: not help — add capacity/features instead High variance with validation still dropping, so more data will... ::: help — the gap keeps shrinking The correct error to rank and choose models on ::: validation error, never training error Why the gap law means diminishing returns ::: halving the gap requires doubling the data since gap is constant The curve you sweep complexity against to see the U-shape ::: the validation curve (training error only ever falls)