Lesson 3 11 min

Keep training and testing apart

Hold back test cards, measure a result, and explain why a repeat test needs new examples.

Learning goal

I can explain how a fresh holdout tells us something about new cases.

How it works

Training data shapes the model. Test data should stay out of that process so it can show how the model handles unfamiliar examples. If you repeatedly tune a model using the same test, information from those results affects the model. Save fresh examples for a later comparison.

Think of it like this

Think of practising similar maths problems and doing an unseen check. Seeing answers in advance changes what the score tells you. A model may fit patterns across many examples, so overlap can be harder to spot than an identical worksheet.

Worked example

The Dock and Loft sorter trains on a striped Dock square and a plain Loft circle. A stripe-based model predicts Loft for a plain Dock square and Dock for a striped Loft circle. It misses both. After that test, the team changes the model to use shape. The two original test cards helped choose the change, so evaluating only on them would overstate how independent the result is. The team sets aside different test cards to check the revised model.

What to remember

Keep training and evaluation separate. Report how many examples you tested and where the model missed.

  1. Set aside the testKeep new cards and their labels out of training.
  2. TrainChoose a clue using training examples.
  3. MeasurePredict test labels before revealing the answers.
  4. Revise and test againAfter changing the clue, save fresh cards for the next test.
Test labels give feedback about a model only after you commit to a prediction.First set aside test data. Train on the other cards, then measure predictions on the test cards. If you use the results to change the model, evaluate that change on a fresh held-back set.

Key words

Training data
Examples a model uses to learn patterns. The examples you choose can affect what it learns.
Test data
Examples held back during training and used to see how a model handles new cases.
Label
An answer or category attached to an example. A card might have the label “pointy” or “round.”
More Machine Learning lessons

Activity

Run a fair card test

Materials Six drawn badge cards, a pencil, and two piles.

  1. For training, draw a striped square labelled Dock and a plain circle labelled Loft. For testing, draw a plain square labelled Dock and a striped circle labelled Loft. Cover the test labels.
  2. Train a toy model to use stripes, predict both hidden labels, then uncover them. Record the number correct out of two.
  3. After using those errors to choose shape, draw two fresh cards, a dotted square labelled Dock and a dotted circle labelled Loft. Check the revised model on those cards.

Talk it through The stripes model scores zero out of two. The revised model scores two out of two on those fresh cards. Two examples give a small check, so report the count with the result.

Quick check

1. What weakens a test of how a model handles new cards?
Answer and explanation

Reusing the same cards that guided the model change as the final test. Those examples influenced the system. A fresh holdout gives better evidence about new inputs.

2. Why say “two out of two” rather than only “100%”?
Answer and explanation

The count shows how little data the result came from. The number correct and the number tried both matter when you interpret a score.