KFoldCrossValidation
K-fold cross-validation is a resampling method used to evaluate the performance of a machine learning model on a limited data set. The data are divided into k folds of roughly equal size. For each of the k iterations, one fold is held out as the test set while the model is trained on the remaining k−1 folds. The process is repeated so that every fold serves as the test set exactly once. The performance scores from the k iterations are then aggregated, typically by computing the mean and often the standard deviation, to provide an overall estimate of model generalization.
Common choices for k are 5 or 10, balancing bias and variance in the estimate. In classification
Applications include estimating model performance, comparing different algorithms, and tuning hyperparameters. Nested cross-validation can be used