Simple, Repeated and Nested Cross-Validation and Bootstrapping fold generation

fold sets up and manages stratified nested RxK-CV and bootstrap folds.


Updated Tue, 07 Mar 2017 07:19:44 +0000

View License

fold is designed to produce cross-validation folds for any learner.
It is designed to be usable with standard, toolbox and contributed learners.
It can be used for randomized or unrandomized, stratified or unstratified CV.
It can be used with arbitrarily complex repeated or nested CV schemes.
It can be used for bootstrapping and CV schemes including bootstrapfolds.
Run initially with parameters, with or without dataset (needed for stratification), returning CV struct.
Subsequently, it can be run with just CV as the parameter to produce the next fold in sequence.
Alternately, a specific nested fold sequence can be specified to control which fold is produced.
It is designed to be used with any (supervised or unsupervised) learning algorithm, including builtin and standard functions, toolboxes and contributed classifiers. The CV returned has index vectors that specify the subset used in each fold.

Cite As

David Powers (2023). Simple, Repeated and Nested Cross-Validation and Bootstrapping fold generation (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

fixed some abbreviated initialization calls and stratification errors - still experimental and needs better documentation

Documentation (Usage Notes) added to discuss the various use cases and when/why CV, Repeated CV, Nested CV or Bootstrapping are required/appropriate.

improved text of description
try again
updating crossrefs