Generates a list of folds for a variety of cross-validation schemes.
make_folds(
n = NULL,
fold_fun = folds_vfold,
cluster_ids = NULL,
strata_ids = NULL,
...
)
- either an integer indicating the number of observations to
cross-validate over, or an object from which to guess the number of
observations; can also be computed from strata_ids
or
cluster_ids
.
- A function indicating the cross-validation scheme to use.
See fold_funs
for a list of possibilities.
- a vector of cluster ids. Clusters are treated as a unit -- that is, all observations within a cluster are placed in either the training or validation set.
- a vector of strata ids. Strata are balanced: insofar as possible the distribution in the sample should be the same as the distribution in the training and validation sets.
other arguments to be passed to fold_fun
.
A list of folds objects. Each fold consists of a list with a
training
index vector, a validation
index vector, and a
fold_index
(its order in the list of folds).
Other fold generation functions:
fold_from_foldvec()
,
fold_funs
,
folds2foldvec()
,
make_repeated_folds()