Skip to main content

Lesson 3 of 3 · About 5 minutes

Choose on validation, report on test

Each time you choose a model using a score, that score becomes part of the selection process. Keep a separate test set for the final evaluation.

Try it

Give each dataset one job. Decide which examples can fit the model, which can choose its settings, and which can support the final report.

Which data belongs in each step?

You have three separate datasets. Assign one to each action in a simple model-selection workflow, then check your choices.

  1. Estimate the weights for each candidate model.

  2. Compare candidate strengths and pick one.

  3. Evaluate after the model and settings are fixed.

Cross-validation rotates the validation role across the development data; it does not spend the final test set. Ordinary shuffled folds suit independent examples from a similar distribution. Time series need time-aware splits, and related observations may need to stay in the same group. Fit preprocessing inside each training fold.

How cross-validation fits in

theorem visual

Cross-validation rotates the holdout instead of spending one fixed test set

Each fold takes one turn as validation data. The average validation loss estimates generalization, but it is still a model-selection signal, not a final test score.

one dataset, five fair validation turnsfold 1fold 2fold 3fold 4fold 5run 1validatetraintraintraintrainrun 2trainvalidatetraintraintrainrun 3traintrainvalidatetraintrainrun 4traintraintrainvalidatetrainrun 5traintraintraintrainvalidateavg5scoresblue cells train the candidateamber cells estimate holdout loss

K-fold score

Train on folds, validate on the remaining fold, then average.

Bias tradeoff

Large trains on more data, so the estimate is less pessimistic.

Variance tradeoff

is LOO-CV

Leave-one-out has low bias but highly correlated fits, so model selection can still be noisy.