Cross-validation#

The question and the claim#

Resampling estimates performance for a specified training procedure and sampling scheme. Separate fitting, tuning, and final evaluation. Preprocessing, feature selection, and prompt selection belong inside training-side resampling when they are learned from data.

What you should be able to do#

  • Specify the scientific target and the observations needed to address it.

  • State the deployment population, draw the split diagram, and assert group disjointness. Explain whether both participants and items must be new.

  • Explain the assumptions, uncertainty, and limits of your conclusion.

Worked investigation#

Compare row-wise and participant-wise splits, tune a polynomial using grouped folds, and evaluate the selected model on untouched participants. Contrast ordinary and nested cross-validation. The worked notebook is self-contained and uses documented teaching data. Its output is evidence about that example, not a finding about a human population.

Challenge the result#

Random folds can share participants, items, families, or future information across analysis and assessment sets. Neither more folds nor LOOCV automatically gives the most useful estimate. Before running an analysis, predict what this failure would change. After running it, distinguish a software check from a scientific justification.

Practice and verification#

Complete the exercise, then discuss the interpretation questions. Submit a runnable notebook, your assumptions, and a short evidence-based interpretation. The shared analysis workflow defines the reporting and assessment standard.

For AI assistance, first write your own target and expected behavior. Use generated suggestions as candidates, inspect the code or claims, and retain evidence of the checks you performed. The AI analysis guide includes a saved-output activity that requires no account or paid service.

Connection across lessons#

Generalization depends on the units defined earlier; resampling also supplies tools for uncertainty and hypothesis testing.

Earlier lecture resources#

The recordings and slides below are retained from the earlier course edition and have not been revised. Use the written chapter, revised notebook, and exercise for current definitions and procedures; earlier examples may conflict with the corrections described here.

Required readings#

Chapter 5: Resampling methods. James, G., Witten, D., Hastie, T., & Tibshirani, R. (2021). An Introduction to Statistical Learning: with Applications in R (2nd edition). New York: Springer.

Lecture (Video)#

Cross validation

Slides (PDF)#

Cross validation