Learn R Programming

tune (version 0.2.0)

augment.tune_results: Augment data with holdout predictions

Description

For tune objects that use resampling, these augment() methods will add one or more columns for the hold-out predictions (i.e. from the assessment set(s)).

Usage

# S3 method for tune_results
augment(x, parameters = NULL, ...)

# S3 method for resample_results augment(x, ...)

# S3 method for last_fit augment(x, ...)

Value

A data frame with one or more additional columns for model predictions.

Arguments

x

An object resulting from one of the tune_*() functions, fit_resamples(), or last_fit(). The control specifications for these objects should have used the option save_pred = TRUE.

parameters

A data frame with a single row that indicates what tuning parameters should be used to generate the predictions (for tune_*() objects only). If NULL, select_best(x) will be used.

...

Not currently used.

Details

For some resampling methods where rows may be replicated in multiple assessment sets, the prediction columns will be averages of the holdout results. Also, for these methods, it is possible that all rows of the original data do not have holdout predictions (like a single bootstrap resample). In this case, all rows are return and a warning is issued.

For objects created by last_fit(), the test set data and predictions are returned.

Unlike other augment() methods, the predicted values for regression models are in a column called .pred instead of .fitted (to be consistent with other tidymodels conventions).

For regression problems, an additional .resid column is added to the results.