What is the intended workflow to perform cross-validation?

What are the advantages of using the 'crossval' function for creating a partitioned model over using a fit function (such as 'fitcsvm') with the 'CrossVal' name-value argument specified?

 Accepted Answer

To create a partitioned cross-validation model, you should always use the ‘CrossVal’ name-value argument in a fit function (such as ‘fitcsvm’). If you are happy with the generalization error from the partitioned model, then you may choose to follow up with a fit to the entire dataset (without cross-validation) to obtain a model that makes full use of the data you have available. 
The ‘crossval’ function is intended for following the above workflow in reverse order. For example, you may want to fit your models to the entire dataset first to help narrow down your options. Then when you settle on one model, you may choose to cross-validate it with the ‘crossval’ function to measure its generalization error. 

More Answers (0)

Products

Release

R2022a

Community Treasure Hunt

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

Start Hunting!