Foundations — Cross-validation — k-fold
Before you can read the parent note Cross-validation — k-fold, you need to earn every symbol it uses. This page introduces them one at a time, each with a plain-words meaning, a picture, and the reason the topic needs it. Nothing here assumes you've met the notation before.
1. A dataset , its size , and its samples
Let's decode every piece of that line, left to right.
- The curly braces mean "a collection of things" — here, a collection of rows.
- Each row is a pair written in round brackets : an input glued to its correct answer.
- The little number below, the subscript , is just a row label — "the -th row". So is the input of row 3.
- The three dots mean "and so on in the same pattern", counting up to the last row .
In the parent's aerospace example, and one row is one flight record: holds the 50 sensor readings (temperature, vibration, pressure), and is a single bit — did the engine fail within 100 hours () or not ()?

2. The fold count and fold sizes
Since we already met , keep the two straight — they play very different roles:
Which is bigger, or ?
If and , how big is each fold?
The picture below shows the clean case where the chop divides evenly.

3. Folds and the "carve out" operations , ,
Before we can write the fold equation, we must name the folds themselves.
The parent then writes . Three new symbols hide in there. Each is a way of talking about groups of rows.
Now the parent's line just says: "gluing all the folds back together rebuilds the whole dataset — nothing lost, nothing added."
And for (read " not equal to ") says: "two different folds share no rows." That is the disjoint property, and it is why a row can never be both trained-on and tested-on in the same round.

The set-minus symbol powers the parent's training-set definition: Read aloud: "the training set for round is the whole dataset with fold removed." The superscript in brackets is just a round label — "the version used in round ", not a power. (Brackets around the top number are the standard way to signal "this is a label, don't multiply.")
4. The learning algorithm and the trained model
Think of as an empty brain and the parentheses as "feed this data into the brain". Out pops a specific fitted model . Because each round removes a different fold, each is a slightly different model.
Why the subscript on ?
5. The metric function and the score
What does the metric use each of its two inputs for? The first, , makes the guesses; the second, , supplies both the inputs to guess from and the hidden true answers to compare against. The parent uses two common metrics:
- Accuracy — fraction of guesses that are correct. Simple, but a liar when one class is rare (guessing "no failure" always gives 95% on a 5%-failure dataset).
- F1 score — a balanced number that rewards catching the rare cases and not crying wolf. Preferred when failures are rare.
You don't need the F1 formula yet — just know is one honest grade per round, and higher is better here.
6. Summation , mean, and the CV score
Here is the symbol that scares the most beginners. It is friendly once unpacked.
Now the headline formula falls out for free:
Why average, not just pick one? One round could get an easy test fold and score high by luck. Averaging rounds cancels good luck against bad luck, giving a steadier estimate of true performance.
7. Spread: the standard deviation
The average alone hides consistency. The parent also reports a spread.
Decode it piece by piece, from inside out:
- — how far one grade sits from the average (a "miss").
- — square it, so negative misses and positive misses both count as positive distance.
- — add up all the squared misses.
- — divide (nearly the average miss; using not is a standard small-sample correction).
- — take the square root to undo the squaring, returning to the original units.
How these pieces feed the topic
Everything on this page is a prerequisite arrow pointing at the same destination: a single trustworthy number (plus a wobble) for how well a model will do on data it has not seen.
Where to go next
- The parent itself: Cross-validation — k-fold
- Before folds, the simplest idea: 5.6.01-Train-test-split-validation-set and 5.6.02-Holdout-method
- Keeping rare classes balanced across folds: 5.6.04-Stratified-sampling
- Pushing all the way to : 5.6.06-Leave-one-out-cross-validation-(LOOCV)
- Why affects reliability: 5.6.10-Bias-variance-tradeoff-in-model-selection
- Prefer to read in Hinglish: 5.6.05 Cross-validation — k-fold (Hinglish)
Equipment checklist
You are ready for the parent note when you can answer each of these without peeking.
What does stand for?
What is the difference between and ?
When is not divisible by , how big is each fold?
What does denote?
What does tell you?
What does mean?
What is the difference between and ?
What kind of object is ?
What does compute?
How do you get from that sum?
What does a large warn you about?
Recall Self-test: rebuild the whole pipeline from memory
Say the five steps out loud: (1) split into disjoint folds; (2) for each fold, train on and test on ; (3) score each round with a metric; (4) average the scores to get ; (5) take the standard deviation for the spread. If you can do all five, open the parent note.