Neura saysCross-validation estimates real performance by training/testing on rotated data folds.
A single train/test split can be lucky or unlucky. k-fold cross-validation splits data into k parts, trains on k-1 and tests on the held-out fold, rotating through all k, then averages — a more reliable performance estimate that uses all data for both roles. Stratified folds preserve class ratios. Use it especially on smaller datasets where one split is too noisy.
Power-ups you unlock
Rotate train/test across k folds, average
More reliable than one split
Stratified folds preserve class balance
Vital on smaller datasets
The Overfit Ogre attacks — common mistakes
Trusting one lucky/unlucky split
Leaking test data into preprocessing/folds
Non-stratified folds on imbalanced data
Boss battleExplain why averaging over folds beats a single split.
Example code
<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>5-fold: train on 4 parts, test on 1, rotate ×5
average the 5 scores → reliable estimate</pre></body></html>