ELI5: n fold cross validation
// explanation
What is n-fold cross validation?
Imagine you have a pile of flashcards you want to test yourself on. Instead of studying with some cards and testing with the same ones (which wouldn't show if you really learned), you'd split them into n equal piles, study with n-1 piles, and test with the leftover pile [1]. Then you repeat this process, using a different pile for testing each time, so every card gets tested exactly once [1].
Why do we do this?
When you train a machine learning model, you want to know how well it will work on brand new data it's never seen before [1]. If you test it on the same data you trained it with, it's like memorizing the answers instead of understanding the materialโyou'll get great scores but fail in the real world [1].
What actually happens?
You split your data into n equal chunks, then do n rounds of testing: in round 1 you use chunk 1 as the test set and chunks 2-n to train, in round 2 you use chunk 2 as the test set and the others to train, and so on [3]. At the end, you average all the test results to get a final score [1].
How do you pick n?
Common choices are 5-fold or 10-fold, with 10 being popular because it balances between having enough training data and being reliable [4][5]. If you have very little data, using a smaller number of folds means each test set is bigger and more reliable [5].
// sources
Cross-validation includes resampling and sample splitting methods that use different portions of the data to test and train a model on different iterations.
Oct 4, 2023 ... Tutorial Overview. This tutorial is divided into 5 parts; they are: k-Fold Cross-Validation; Configuration of k; Worked Example; Crossย ...
A depiction of a 5 fold cross validation on a training set, while holding out. 3.1.1. Computing cross-validated metrics#. The simplest way to use cross-ย ...
Jun 10, 2020 ... I understand the effects of using a smaller k versus a larger k in terms of bias. But why is it 10? And no 5 or 20? How could one end up on theย ...
May 31, 2015 ... In LOOCV(leave one out CV), you get estimates of test error with lower bias, and higher variance because each training set contains n-1 examplesย ...
Video by StatQuest with Josh Starmer

Video by Udacity

Video by AI For Beginners
