Curvingo · Made in India

Glossary

Select one of the keywords on the left…

Testing Your AIK-Fold Cross-Validation

Reading time: ~5 min

Instead of hoping for a fair split, let every farm take a turn in the validation set. That is k-fold cross-validation.

Here is the recipe:

  1. Cut the data into k equal parts, called folds.
  2. Hold out one fold for validation, train on all the others, and score the model on the held-out fold.
  3. Repeat with each fold in turn, starting a fresh model every time, until every fold has been held out once.
  4. Average the k scores. That average is the cross-validation score.

Each row below is one round: the teal squares are the farms held out, the blue ones the farms the model trains on. The chart under the button keeps the average error of every k you run. Choose k, run the folds and complete both missions.

Number of folds: k = ${k}

With 5 folds the five scores were 0.72, 0.30, 0.08, 0.34 and 0.48 — as wide a spread as the random splits. But their average, 0.38, uses every farm once for validation, so it does not depend on one lucky or unlucky fold. The catch: k-fold trains a new model , so it costs k times as much computing.

Sina