`fit_models` is a wrapper function for fitting multiple models using caret, tidymodels, or h2o backends. This wrapper function provides uniformity of input arguments to easily switch between the different modeling packages.

fit_models(
  Xtrain,
  ytrain,
  model_list,
  cv_options = list(),
  train_options = list(),
  use = c("caret", "h2o", "tidymodels"),
  verbose = 0
)

Arguments

Xtrain

Training data matrix or data frame.

ytrain

Training response vector.

model_list

List of models to train. Each name in the list should correspond to the name of the model to fit (see caret, h2o, or tidymodels for a list of available models). Each list element is a list of named model options. See `model_options` arugument and details of `fit_model()` for possible options and more information.

cv_options

List of cross-validation options to use for tuning hyperparameters. Possible options are `nfolds` (default is 10), `foldids`, and `metric`. `nfolds` gives the number of folds in the cross-validation scheme. `foldids` is a list with elements for each cross-validation fold, where each list element is a vector of integers corresponding to the rows used for training in that fold. `metric` is a string that specifies which metric to use to select the best hyperparameters. See details below.

train_options

List of additional training control options. See details of `fit_model()` for possible options and more information.

use

One of "caret", "h2o", "tidymodels", indicating the modeling package to use.

verbose

Level of verbosity (0-2).

Value

A list of the same length as `model_list` with the fitted models. See `fit_model` for details of specified outputs for each of the modeling backends.

See also

Other fit_models_family: fit_model