Skip to contents

Calculate and store the predicted outcomes for each validation set observation during model tuning

Usage

tof_find_cv_predictions(
  split_data,
  prepped_recipe,
  lambda,
  alpha,
  model_type,
  outcome_colnames
)

Arguments

split_data

An `rsplit` object from the rsample package. Alternatively, an unsplit tbl_df can be provided, though this is not recommended.

prepped_recipe

A trained recipe

lambda

A single numeric value indicating which penalty (lambda) value should be used to make the predictions

alpha

A single numeric value indicating which mixture (alpha) value should be used to make the predictions

model_type

A string indicating which kind of elastic net model to build. If a continuous response is being predicted, use "linear" for linear regression; if a categorical response with only 2 classes is being predicted, use "two-class" for logistic regression; if a categorical response with more than 2 levels is being predicted, use "multiclass" for multinomial regression; and if a time-to-event outcome is being predicted, use "survival" for Cox regression.

outcome_colnames

Quoted column names indicating which columns in the data being fit represent the outcome variables (with all others assumed to be predictors).

Value

A tibble containing the predicted and true values for the outcome for each of the validation observations in `split_data`.