Have a small dataset and want to evaluate a model without setting aside one fixed validation portion? K-fold cross-validation rotates the data through training and validation. Split it into k roughly equal portions; train k times, holding out a different portion for validation each time; then average the validation scores. section 13.6
Four folds
Divide the data into four portions. Train four times, using three portions for training and the remaining portion for validation each time. The model’s final score is the average of the four validation scores. section 13.6
Figure 13.2 K-fold cross validation is a useful method that recycles our data to use it both as training and as validation. On the top, we see the classical training-validation split. On the bottom, we see an illustration of fourfold cross-validation in which we split the data into four equal (or almost equal) portions. We then train our model four times. Each time we pick three of the portions as the training set, and the remaining one as the validation set. The score of this model is the average of the four scores obtained on each of the validation sets.
Compare a conventional training-validation split with the four-fold rotation of training and validation portions. section 13.6
K-fold cross-validation is used in GridSearchCV; its results can be inspected through cv_results_. section 13.6











