FUNCTION REFERENCE

cvpartition

Create reusable training and test partitions.

Create reusable training and test partitions.

Syntax

c = cvpartition(n,'KFold',k); c = cvpartition(group,'Holdout',p); c = cvpartition(n,'Leaveout'); c = cvpartition(n,'Resubstitution')

A group vector creates stratified partitions. Properties are NumObservations, NumTestSets, TrainSize and TestSize. training and test return logical observation masks. repartition creates another partition of the same type; rng controls the random stream. Classification and regression crossval accept the same CVPartition objects, including stratified group partitions.

Example

rng(3); c=cvpartition([1;1;2;2],'KFold',2); mask=test(c,1)

Differences from MATLAB: Bounded to 20000 observations. Holdout is a fraction strictly between zero and one. Missing group labels, grouping-variable and custom partition options are unsupported.

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