Foundations — Training, validation, and test error
Before you can read a single formula in the parent note, you need to earn every symbol it uses. This page introduces them one at a time, from absolute zero, so that by the end you will understand every piece of a line like "average loss over the validation cards" — including the funny subscripts and Greek letters.
0. The picture everything hangs on
Imagine a big box of index cards. Each card has a question on the front and the true answer on the back. That box is our dataset. Everything in this topic is about how we deal these cards into three smaller boxes.

Look at the three coloured boxes. The orange box (train) is huge — that is where the model studies. The teal box (validation) is smaller — that is where we compare study methods. The plum box (test) is sealed shut until the very end — that is our final exam.
1. A data point:
- = the question. It could be an image, a row of numbers, a sentence. Picture the front of one card.
- = the true label. Picture the back of the same card.
We write them glued together as a pair — "this input goes with this target."
Why the topic needs it: every error we ever compute is built by going card-by-card and comparing the model's guess to the real . No cards, nothing to measure.
2. The model as a guessing machine: and
The little hat () is a universal maths symbol meaning "an estimate — our best guess, not the truth." So is our guessing function, and is the guess it makes for card .

In the figure: a card front goes into the orange machine, and out comes . Next to it sits the real answer . The gap between the two arrows is what "error" will measure.
Why the topic needs it: the model is the whole point. Training, validation, and test errors are all just "how far is from ", counted over different boxes of cards.
3. The knobs: parameters and the best setting
- = any setting of the dials.
- (theta-star) = the one special setting that makes the guesses fit the training cards as closely as possible. The star always means "the best / chosen one."
That is why the parent writes — read "the guess for using the chosen dial settings". The semicolon just separates "the input we feed" from "the dials we've fixed."
Why the topic needs it: training is the act of searching for . Everything after training uses that frozen .
4. Being wrong, measured: the loss
Read as "the loss between the real answer and our guess."
A simple example of a loss is the squared gap (used when is a number, like a price or a temperature): Picture a ruler measuring the vertical distance between the dot (truth) and the line (guess), then squaring it so negatives don't cancel positives.

In the figure each teal dot is a true ; the orange line is . The vertical dashed segments are the gaps. Loss turns each segment into a positive number.
Why the topic needs it: you cannot average "wrongness" until you have turned each guess into a single number. does exactly that, one card at a time — whether the answer is a number (squared loss) or a category (0-1 loss).
5. Counting and adding: , , and the average
- is a counter — it walks through the cards one by one.
- is how many cards are in the box (so = number of training cards, = number of validation cards, and so on).
The subscript on and just means "the -th card's front and back."
Why the topic needs it: all three errors you meet next are this exact formula. The only thing that changes is which box of cards you loop over.
6. The three errors, named at last: , ,
Now that you own , , , and the average, the three errors are simply the same average run over three different boxes. The little word underneath each (the subscript) tells you which box.
7. Where the cards come from: the distribution
Picture a giant lottery machine tumbling infinitely many cards; our dataset is one scoop.
Why the topic needs it: the whole promise of "validation error tells you about real-world performance" relies on the validation cards being a fair, random slice from the same factory that will produce future cards.
8. The expected value and the true error
So the true generalization error is read: "the average loss over all cards the factory could ever make." The subscript says "cards drawn from the factory."
Why the topic needs it: is the target we secretly care about; and are the measurable shadows of it.
9. Comparing two errors: the gap
- : studies and exam scores match → healthy.
- (much bigger than zero): aced the studying, flunked the exam → overfitting (see Overfitting and Regularization).
Why the topic needs it: the gap is the single most important diagnostic number the topic teaches — it is the signal of overfitting.
How the foundations feed the topic
Each box you build on this page becomes a symbol you use in the parent note. Follow the arrows: cards + model + knobs → loss → averaged → the three errors → their difference.
Where these lead next
- The full three-box strategy: the parent note
- What to do when is large: Overfitting and Regularization
- Squeezing reliable estimates from tiny datasets: Cross-Validation
- Choosing between models honestly: Model Selection
- Watching errors change as data grows: Learning Curves
- The quantity all of this estimates: Generalization Error
- The classic way to accidentally cheat: Data Leakage
Equipment checklist
Cover the right side and answer out loud — if you can, you are ready for the parent note.