Skip to content
AI360Xpert
Beta
Core ML

Visual explainer

Cross-Validation

How rotating the held-out slice over five folds turns one lucky split into an honest average.

One 80/20 split can trap the hardest cases in the 20 and report 0.25 instead of 0.208.
One 80/20 split can trap the hardest cases in the 20 and report 0.25 instead of 0.208.

You split 80/20 once and the hardest cases all hide in the 20. Your score reads 0.25 while the honest value is 0.208. One slice decided, and luck decided the slice for you.

Cut Five Strips

One hundred points cut into five strips of twenty, each strip taking one turn held out.
One hundred points cut into five strips of twenty, each strip taking one turn held out.

Cut your hundred points into five strips of twenty. Each round trains on 80 and tests on a different 20. Every point gets tested exactly once and trains four times over.

Average Five Scores

Five rounds score 0.22, 0.18, 0.25, 0.20 and 0.19, averaging exactly 0.208.
Five rounds score 0.22, 0.18, 0.25, 0.20 and 0.19, averaging exactly 0.208.

Run all five rounds and write down each error: 0.22, 0.18, 0.25, 0.20, 0.19. They sum to 1.04, so divide by 5 for exactly 0.208. No single round gets the final word anymore.

Deal Rare Cases Evenly

With ten rare positives each fold of twenty keeps exactly two of them.
With ten rare positives each fold of twenty keeps exactly two of them.

Ten positives in a hundred means random folds often test on zero of them. Stratifying deals exactly two rare cases into every fold of twenty. No fold grades on the majority class alone.

Steadier For Five Times Cost

Five scores spread only 0.07 wide around 0.208, while one split gambles on 0.25.
Five scores spread only 0.07 wide around 0.208, while one split gambles on 0.25.

Your five scores span just 0.07 around a mean of 0.208, plus or minus 0.025. The single split gambled everything on 0.25. You bought that steadiness with five trainings instead of one.

Count Your Trainings

Five folds cost five trainings and ten cost ten, so use one split for giant deep nets.
Five folds cost five trainings and ten cost ten, so use one split for giant deep nets.

Five folds is the usual pick for tabular data. Ten folds suits tiny datasets where every point matters. But when one training takes days, you flip to a single split and accept the noise.

Where It Breaks

Scaling with the whole mean before splitting leaks the held out fold into training.
Scaling with the whole mean before splitting leaks the held out fold into training.

Scale with the whole dataset mean before splitting and the held-out fold already whispers through your training. Scores read a lying 0.12. Split first, fit the scaler on the 80, then apply it to the 20.

The Quick Version

  • One split traps hard cases, reports 0.25.
  • Five strips of twenty share the work.
  • Scores average to exactly 0.208.
  • Each fold keeps two rare positives.
  • Five trainings buy plus or minus 0.025.
  • Giant nets flip back to one split.
  • Scale inside folds, never before them.