How do you grade a model honestly?
Lesson 18.2 · Training Data vs. Test Data
Felix · Rosa
Rosa: “What does it score on players it never saw?” Felix: “…I used all of them.”
Felix builds a model to predict rebounds from height, using all 300 NBA players.
It looks great. Rosa asks what it would score on players it hadn’t seen. Felix has none left. He used them all.
Rosa suggests he hide some before he starts next time.
The short answer
Hide a random slice before training and grade only on it. Felix reruns it: 210 players to train, 90 hidden. The training score barely changes. The test score is a little lower and a lot more believable. That gap is the price of honesty, and it’s small when the model actually learned.
Try it yourself
Drag the divider to choose how many players the model trains on. The rest are hidden and used only to grade it.
Test error: 2
What you just did has a name
Train/test split
Before training, split the data: most of it (often 70 or 80 percent) trains the model, and the rest is locked away.
After training, grade the model on the locked-away part.
The test score is the only number that predicts how it will do in the world.
A few more things
Split at random
Train on the tallest players and test on the shortest and you’ve built Module 6’s lunch line. Shuffle first, then split, so both halves look like the whole.
Never peek
If you adjust the model after looking at the test score, the test data has leaked into training and the score is inflated. Serious teams keep a final test set they look at exactly once.
Small data, big problem
Ashley has sixteen videos. Hold out four for testing and she trains on twelve. Every model she builds is going to be shaky, and the test score will say so. That’s the test doing its job.
Go deeper
The longer version, if you want it.
Validation and cross-validation
Real projects split three ways: training data to fit the model, validation data to tune choices like the threshold or the number of groups, and a test set touched once at the end. Tuning on the test set turns it into more training data and the honest score is gone.
When data is scarce, cross-validation rotates the split: divide into five slices, train on four and test on the fifth, five times, once per slice, and average the five test scores. Every row gets tested exactly once and every row gets used for training. It’s how Ashley’s sixteen videos could be graded without wasting a quarter of them.
Quick check
Owen trains a model on 1,000 reviews, then checks its score on 200 of those same reviews. Is that a test score?
Let’s take it slower
Think of it as grading a take-home exam. If the student wrote the answer key, the exam tells you nothing. So you tear the deck of data in two before the model ever sees it. The bigger pile is study material. The smaller pile goes in a drawer, and the model doesn’t get to look. Train, then open the drawer and grade. The drawer score is the honest one because the model couldn’t have memorized what it never saw. Shuffle before you tear, so both piles look like the whole.
More examples
Holding back last season
A model that predicts soccer results is trained on seasons up to last year, and last season stays in a drawer. When it predicts last season’s results, that score is the one to trust. Grading it on the seasons it studied would only show it remembers old scores.
The pet recognizer
A team trains a pet-recognizer on 10,000 photos and sets aside 2,000 it never trains on. It scores 98 percent on the training pile and 88 on the set-aside pile. The 88 is what you’d see on your own camera roll, and that gap is the number worth writing down.
Back to the question
So how do you grade honestly?
Show the answer
Hide a random slice before training and grade only on it. Felix reruns it: 210 players to train, 90 hidden. The training score barely changes. The test score is a little lower and a lot more believable. That gap is the price of honesty, and it’s small when the model actually learned.
One last question
Build the honest grading recipe.
Tap the pieces in order. Tap one again to take it back.
Talk Card
Talk Card · 18.2
Hide a slice of the data before training, then grade the model only on the slice it never saw. That test score is the one that predicts the real world.
Data to AI · pettigrewlab.com/learn

