freecoding.school100% FREE · NO SIGNUP
Tensor TownISSUE #31 of 120

train · val · test splits

NeuraVSThe Overfit Ogre
Neura saysSplit data into train, validation, and test sets — and never let test leak.

The training set fits the model; the validation set tunes hyperparameters and picks models; the test set is touched once, at the end, to estimate real-world performance. Mixing them causes leakage — optimistic scores that collapse in production. The cardinal rule: the test set is sacred. Tuning on it is the most common way people fool themselves.

Power-ups you unlock

The Overfit Ogre attacks — common mistakes

Boss battleAssign roles: which set tunes hyperparameters, which estimates real performance?

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>train → fit the model
val   → tune & select
test  → final, one-time judgment (never tune on it)</pre></body></html>
▶ Open the interactive comic issue
‹ Cross-Validation · K-Fold · StratifiedData Augmentation · Flips · Crops · Mixup ›