Lesson 11
Learning Curves
Nine beginner steps on eight students: train miss, validation miss, and how that gap shows whether more new data will help.
What You Will Learn
Nine steps. One class. The question is not "what is the score?" It is "if I add students, does the miss on new students fall?"
- 1. What is a learning curve?
- 2. Three curves people mix up
- 3. Where is it used?
- 4. Where it sits in the workflow
- 5. What a single score hides
- 6. How the gap decides the next step
- 7. Key Takeaways
- 8. Mind Map
- 9. Quiz
1. What is a learning curve?
A learning curve is two lines on one picture.
The horizontal axis is how many students you trained on. Here that is 2, then 4, then 6, then 8.
The vertical axis is the average miss in marks. Lower is better. A miss of 0 means every predicted mark matched the real mark.
One line is the training miss: students the model has already seen. The other is the validation miss: three students locked away before training. Those three never enter the training pile. If you score only the students you trained on, a memorizer looks perfect and you learn nothing.
The picture at the top is already the whole idea. The memorizer's training miss is 0 at every size, because it stores the rows it saw. The validation miss falls 28.3 → 15 → 8.3 → 5. More students helped the students it had not seen. The lines have not met. Another batch is still worth collecting.
2. Three curves people mix up
| Name | Horizontal axis | What it answers |
|---|---|---|
| Learning curve | How many training rows | Will more data help? This page. |
| Step curve | How many update steps | Is training still walking downhill? That picture is on the gradient descent page. |
| Validation curve | A knob, such as tree depth or the fine in regularization | Is the model too simple or too wiggly, with the class size held still? |
A step curve can fall while the learning curve says more rows will not help. They are different questions. Do not put "epoch" on the horizontal axis and call it a learning curve.
The validation curve, in shape: as the model is allowed to bend more, the training miss keeps falling, and the validation miss falls and then rises. The rise is the moment it starts reciting the training rows. That diagnosis is the same family as bias and variance. The learning curve tells you whether data is the remedy. The validation curve tells you whether the model is the remedy.
3. Where is it used?
Before you spend money or weeks collecting more rows.
| You see | You do |
|---|---|
| Validation miss still falling at the right edge | Collect more training rows |
| Both misses high, and the validation line is flat | Change the model or the columns. More copies of the same rows will not fix it |
| Both misses low and close | Stop. The score you care about is already in hand |
| Training miss near 0, validation miss far above it | The model is reciting. More rows may close the gap. A simpler model may too |
A single accuracy can lie in the same way a rare class hides inside imbalanced data. A learning curve of the wrong score will look healthy. Plot the miss you actually care about.
4. Where it sits in the workflow
- Lock the validation students away. On this page they are the hours 1.5, 4.5, and 7.5.
- Train on 2 students. Score train and validation.
- Add students. Score again. Do not move the validation three into the training pile halfway through, or the curve will cheat.
- Read the gap, then decide: more rows, a new column as in feature engineering, or a different model.
5. What a single score hides
The flat model ignores hours and always says 50.
The validation marks are 35, 65, and 95.
|35 − 50| + |65 − 50| + |95 − 50| = 15 + 15 + 45 = 75
75 / 3 = 25
That 25 does not use the training rows, so it stays 25 at 2, 4, 6, and 8 students. The chart shows it as a level line. The training miss moves, 15 then 10 then 15 then 22.5, because the class spreads out while the guess stays 50. Nothing in that picture says "collect another 100 students."
A score reported once, after training on all 8, would be "validation miss 25." You would not know it was already 25 when you had only 2 students. The curve is what makes the waste visible.
6. How the gap decides the next step
The rule in this class, before any wobble, is marks = 20 + 10 × hours.
| Hours | Marks | Role |
|---|---|---|
| 1, 2, 3, 4, 5, 6, 7, 8 | 30, 40, 50, 60, 70, 80, 90, 100 | Training, added from the left |
| 1.5, 4.5, 7.5 | 35, 65, 95 | Validation, never trained on |
The memorizer, worked at 2 students
Training rows: hour 1 → 30, hour 2 → 40. It can recite those, so the training miss is 0.
For a new hour it copies the nearest training hour. If two hours are equally near, it takes the higher hour.
| Held-out hour | Nearest | Predicted | Actual | Miss |
|---|---|---|---|---|
| 1.5 | 1 and 2, tie, take 2 | 40 | 35 | 5 |
| 4.5 | 2 | 40 | 65 | 25 |
| 7.5 | 2 | 40 | 95 | 55 |
Average validation miss = (5 + 25 + 55) / 3 = 85 / 3 = 28.3
Add hours 3 and 4 (marks 50 and 60). The same three held-out students now miss 5, 5, and 35.
(5 + 5 + 35) / 3 = 15
Add hours 5 and 6. The misses are 5, 5, and 15.
(5 + 5 + 15) / 3 = 8.3
Add hours 7 and 8. The misses are 5, 5, and 5.
15 / 3 = 5
Training miss is still 0. The gap at 8 students is 5 − 0 = 5 marks. The validation line is still falling, so the next experiment is more students with new hours, not a fancier copy of these 8.
The straight line
Predict 20 + 10 × hours. Hour 1.5 gives 35. Hour 4.5 gives 65. Hour 7.5 gives 95. Every training hour matches too. Train miss 0. Validation miss 0. At every class size.
Both lines sit on the floor and touch. More students will not improve a miss that is already 0. Spend the next hour checking a genuinely new student, not growing this table.
What to do with each shape
| Shape on this class | Next step |
|---|---|
| Memorizer: train 0, validation 28.3 then 5, gap still open | Add students. The curve has not flattened |
| Flat guess of 50: validation stuck at 25 | Stop collecting. Use hours. The straight line already has miss 0 |
| Both lines at 0 | The rule fits. Do not add complexity |
Copying the same 8 students twice is not "more data" in the sense this curve means. The memorizer already recites them. New hours are what pulled 28.3 down to 5.
Reading the table in pandas
The misses above are the lesson. Pandas does not calculate them. It prints them so you can check the shape in one table. The only import is import pandas as pd. DataFrame builds the columns. print shows the curve.
import pandas as pd
curve = pd.DataFrame({
"students": [2, 4, 6, 8],
"memorizer_train": [0, 0, 0, 0],
"memorizer_val": [28.3, 15, 8.3, 5],
"flat_val": [25, 25, 25, 25],
"line_val": [0, 0, 0, 0],
})
print(curve)memorizer_val is the line that is still falling. flat_val is the line that refuses to. line_val is already finished.
7. Key Takeaways
- A learning curve plots miss against how many training rows, with the validation students held out.
- On the memorizer, validation miss falls 28.3, 15, 8.3, 5 while training miss stays 0.
- A gap that is still shrinking means more new students can help.
- The guess of 50 keeps a validation miss of 25 no matter how many students you add.
- The line 20 + 10 × hours has miss 0 on both piles. More data is not the next step.
- A step curve and a depth curve answer different questions. Do not swap their axes.
- Score the miss you care about. A flattering score draws a flattering curve.
8. Mind Map
At 2 students the memorizer is 28.3 marks off on the held-out three. At 8 students it is 5 marks off, and the line is still descending. The flat model is still at 25. If you can say which of those two should get more students, the page is yours.
9. Quiz
The questions use this class. Validation hours 1.5, 4.5, and 7.5. Memorizer validation misses 28.3, 15, 8.3, and 5. The flat validation miss is 25. The line miss is 0.
Loading playground…
Check your understanding
Learning Curves Quiz
On this page, what is the horizontal axis of the learning curve?
1 / 6