💡 Concept Anchor · Machine Learning
CROSS-VALIDATION = Taking the SAME EXAM multiple times with different questions each round
K-fold cross-validation — why one test isn't enough
1
Split into K equal chunks
The full dataset is divided into K roughly equal-sized chunks (folds), commonly K=5 or K=10.
Example: with K=5, a dataset of 1,000 examples gets split into five chunks of 200 examples each.
2
Rotate the test chunk each round
In each round, one chunk serves as the test set while the remaining K-1 chunks train the model. This repeats K times, so every chunk gets a turn as the test set exactly once.
Example: in round 1, chunk 1 is the test set and chunks 2-5 train the model; in round 2, chunk 2 becomes the test set and chunks 1, 3, 4, 5 train it — and so on.
3
Average the K scores
After all K rounds are complete, the K performance scores are averaged together to produce a single, more reliable overall performance estimate.
Example: averaging five accuracy scores (one from each round) into a single mean accuracy figure that better reflects true expected performance.
1
A model scores 92% accuracy on a single train/test split, but the data scientist is unsure if that split happened to be unusually easy or lucky.
2
Ask: how can they get a more reliable estimate than a single lucky or unlucky split? Use K-fold cross-validation instead of a single split.
3
Running 5-fold cross-validation, they get five different accuracy scores: 88%, 91%, 85%, 93%, 89%.
4
Averaging these five scores gives a far more reliable estimate of the model's true expected performance than relying on any single split, which could have been unusually favorable or unfavorable.

Exams test whether you understand WHY cross-validation is more reliable than a single train/test split — the core reason is that any single split could be lucky or unlucky, and averaging across K rotations smooths out that variability. Expect questions asking you to identify the standard values of K (5 or 10) and to explain the rotation process.

The most common trap is assuming cross-validation replaces the need for a completely separate, final test set. In rigorous workflows, cross-validation is typically used during model development and tuning (similar to a validation set), while a truly held-out test set is still reserved separately for the final, honest performance evaluation.

1. What does K-fold cross-validation split the data into?
K roughly equal-sized chunks (folds).
Tap to reveal / hide
2. How many times does the test chunk rotate in K-fold cross-validation?
K times — so that every chunk serves as the test set exactly once.
Tap to reveal / hide
3. Why is averaging K scores more reliable than a single train/test split?
Because a single split could be unusually lucky or unlucky; averaging across many splits smooths out that variability for a more reliable estimate.
Tap to reveal / hide
4. What are the two most standard values used for K?
K=5 or K=10.
Tap to reveal / hide
5. Does cross-validation eliminate the need for a separate final test set?
No — cross-validation is typically used during development/tuning, while a separate held-out test set is still reserved for the final, honest evaluation.
Tap to reveal / hide