Cross-Validation

Definition

Divide data into folds. Hold out one fold per round, refit on the rest and combine errors on cases unseen during that fit. When predicting for new stores, machines or people, keep related records in the same fold.

Core rule: Decide whom the model must generalize to and choose split units and metrics. Repeat imputation, feature building and fitting inside each training fold. If validation results guided selection, use an outer evaluation or independent data for the final comparison.

Imagine a repair team taking five photos apiece of forty machines. They want a model that can look at a photo and tell whether the wiring has come loose. It gets ninety-five percent right in testing, so the team puts it to work on a newly arrived batch.

On those machines, the model gets the wiring wrong again and again. The team has to go back and find out what it did to earn that score.

This is where cross-validation comes in. You split your data into parts, take turns testing on one part, and train on the rest each time. Then you combine the scores. Let's follow the team through a second exam and see what that tells you about setting one up yourself.

How it works

Start with how they might set the exam. Suppose they divide the photos into five parts, called folds. In the first round, one fold sits out for the test while they train on the other four. Then the second fold sits out, and they train a fresh model.

By the time they finish the rotation, each photo has appeared on the test exactly once. The errors from all those rounds give them an estimate of how the model will do on new data.

  1. 01 · Define what is new Decide whether to hold out rows, people or entire sites.
  2. 02 · Rotate holdout folds Rotate validation folds and redo preparation and fitting on the others.
  3. +1 more mechanism steps & animation in the app

When it fails & limits

There are still ways to set a bad exam. The first comes up when you're trying to predict the future.

✦ Unlock full lesson in ConceptFlow

Unlock the full Cross-Validation lesson in ConceptFlow

You’ve read the core idea and opening case. Get the ConceptFlow app to continue through the full breakdown, failure modes, 5-minute audio lesson, and decision practice.

  • ▸5-minute English & Mandarin audio lesson
  • ▸5 more deep-dive case & mechanism insights
  • ▸All 5 failure boundaries & counter-examples
  • ▸4-point decision checklist + 6-step practice

Tap a store button on mobile, or scan with your phone camera on desktop.