Skip to content


K Fold#

K Fold is a cross validation technique that splits the training set into k individual folds and for each training round uses 1 of the folds to test the model and the rest as training data. The final score is the average validation score over all of the k rounds. K Fold has the advantage of both training and testing on each sample in the dataset at least once.

Interfaces: Validator, Parallel


# Name Default Type Description
1 k 5 int The number of folds to split the dataset into.


use Rubix\ML\CrossValidation\KFold;

$validator = new KFold(5, true);