FUNCTION REFERENCE

ClassificationPartitionedModel

Cross-validated classification model returned by crossval.

Cross-validated classification model returned by crossval.

Syntax

cvmdl = crossval(mdl, 'KFold', k)

Holds per-fold trained classifiers and partition indices. Fit the model first, then pass it to crossval with a k-fold or holdout partition. Evaluate out-of-fold predictions and loss with kfoldPredict and kfoldLoss.

Example

mdl = fitcknn([0; 0.1; 1; 1.1; 2; 2.1], [1; 1; 1; 2; 2; 2]); cv = crossval(mdl, 'KFold', 3); class(cv)   % 'ClassificationPartitionedModel'

Differences from MATLAB: fitcknn does not accept the inline 'CrossVal', 'on' option.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.