Log inStart free
LESSON 4.53 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Cross-validation

Watch 24 blood tests rotate through K folds, then leak through shared patients.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 4.53 · VALIDATION BAYHOLDOUT · ACCURACY 1.00
01
Stage 1 of 6 · One split
One split holds out 6 of 24 tests. A nearest neighbor model scores 1.00 on them.
Explain it simply

Each mark is one blood test. A dot is sick and a square is healthy. The model labels each blue test like its nearest teal test, and this split scores 1.00. A different split could score quite differently.

Row 1 holds out 6 tests and trains on 18. Accuracy 1.00.

training testheld-out testwrong or same patientchosen k
patient Apatient Bpatient Cpatient Dpatient Epatient Ffold 11.00one splittestsaccuracyacc = 6 / 6 = 1.00patient Apatient Bpatient Cpatient Dpatient Epatient Ffold 11.00one splittestsaccuracyacc = 6 / 6 = 1.00
Toy: 24 tests · 6 patients · 1-NN on one marker
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
acc=cntest\sy{acc}{out}{\text{acc}} = \dfrac{\sy{c}{out}{c}}{\sy{n}{data}{n_{\text{test}}}}
acc=6/6=1.00\text{acc} = 6 / 6 = 1.00

Accuracy is the right answers over the held-out tests.

Common mix-ups

MYTHA shuffled K-fold score is honest for any data.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01Switch the split to grouped. Does the CV score go up or down?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.