Class: cvpartition
Training indices for cross-validation
idx = training(c)
idx = training(c,i)
idx = training(c)
returns the logical vector idx
of
training indices for an object c
of the cvpartition
class
of type 'holdout'
or 'resubstitution'
.
If c.Type
is 'holdout'
, idx
specifies
the observations in the training set.
If c.Type
is 'resubstitution'
, idx
specifies
all observations.
idx = training(c,i)
returns the logical
vector idx
of training indices for repetition i
of
an object c
of the cvpartition
class
of type 'kfold'
or 'leaveout'
.
If c.Type
is 'kfold'
, idx
specifies
the observations in the training set in fold i
.
If c.Type
is 'leaveout'
, idx
specifies
the observations left in at repetition i
.
Identify the training indices in the first fold of a partition of 10 observations for 3-fold cross-validation:
c = cvpartition(10,'kfold',3) c = K-fold cross validation partition N: 10 NumTestSets: 3 TrainSize: 7 6 7 TestSize: 3 4 3 training(c,1) ans = 0 0 1 1 1 1 1 1 0 1