Repartition data for cross-validation
Repartition Data for Cross-Validation
Repartition observations in a
cvpartition object. The type of validation partition remains the same.
Partition 100 observations for 3-fold cross-validation.
c = cvpartition(100,'KFold',3)
c = K-fold cross validation partition NumObservations: 100 NumTestSets: 3 TrainSize: 67 66 67 TestSize: 33 34 33
Repartition the observations.
cnew = repartition(c)
cnew = K-fold cross validation partition NumObservations: 100 NumTestSets: 3 TrainSize: 67 66 67 TestSize: 33 34 33
Notice that the set of observations in the first test set (fold) of
c is not the same as the set of observations in the first test set of
ans = logical 0
View the validation partition type of
cnew are validation partitions of the same type,
ans = logical 1
ans = 'kfold'
Repartitioning is useful for Monte Carlo repetitions of cross-validation analyses.
repartitionwhen you specify the
'MCReps'name-value pair argument.
Introduced in R2008a