`predict_models` is a wrapper function for making predictions from multiple fitted models that were trained using caret, tidymodels, or h2o backends. This wrapper function provides uniformity of input arguments to easily switch between the different modeling packages.

predict_models(fit_list, Xtest, options = list(), use = NULL)

Arguments

fit_list

List of fitted models for which to make predictions. Typically the output of `fit_models()`.

Xtest

Data matrix or data frame on which to make predictions.

options

Named list of additional arguments to pass to `predict.train()` if using caret backend, `h2o.predict()` if using h2o backend, or `predict.workflow()` if using tidymodels backend. If different arguments need to be passed in for different fitted models, `options` should be a list where each element is named after the model (i.e., the same name as in `fit_list`) and is a list of named arguments. If `options` is not a list of list, then all list elements are passed to the predict function for every model.

use

One of "caret", "h2o", "tidymodels", indicating the modeling package to use. If NULL (default), the modeling package is inferred from the fit.

Value

A tibble with the following columns:

method

Name of method that made the associated prediction.

predictions

Raw predicted value (e.g., the predicted class in a classification problem and the predicted continuous value in a regression problem.)

prob_predictions

In a classification problem, this is a tibble with the predicted probabilities for each class. This column is omitted for regression problems.

Note that the order of the predictions within each method are aligned with that of the Xtest input.

See also

Other predict_models_family: predict_model