Unlike caret::trainControl, this function defaults to 5 fold CV. CV is good for stacking, as every observation is in the test set exactly once. We use 5 instead of 10 to save compute time, as caretList is for fitting many models. We also construct explicit fold indexes and return the stacked predictions, which are needed for stacking. For classification models we return class probabilities.
defaultControl(
target,
method = "cv",
number = 5L,
savePredictions = "final",
index = caret::createFolds(target, k = number, list = TRUE, returnTrain = TRUE),
is_class = is.factor(target) || is.character(target),
is_binary = length(unique(target)) == 2L,
...
)
the target variable.
the method to use for trainControl.
the number of folds to use.
the type of predictions to save.
the fold indexes to use.
logical, is this a classification or regression problem.
logical, is this binary classification.
other arguments to pass to trainControl