Resampled predictions are commonly used for:
Analyzing accuracy and stability of models
As inputs to Ensemble methods (refer to the
modeltime_fit_resamples(object, resamples, control = control_resamples())
A Modeltime Table
The function is a wrapper for
tune::fit_resamples() to iteratively train and predict models
contained in a Modeltime Table on resample objects.
One difference between
is that predictions are always returned
control = tune::control_resamples(save_pred = TRUE)). This is needed for
Resampled Prediction Accuracy
Calculating Accuracy Metrics on models fit to resamples can help
to understand the model performance and stability under different
forecasting windows. See
getting resampled prediction accuracy for each model.
Fitting and Predicting Resamples is useful in
creating Stacked Ensembles using
The sub-model cross-validation predictions are used as the input to the meta-learner model.
A Modeltime Table (
mdl_time_tbl) object with a column containing
resample results (
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
library(tidymodels) library(modeltime) library(timetk) library(tidyverse) # Make resamples resamples_tscv <- training(m750_splits) %>% time_series_cv( assess = "2 years", initial = "5 years", skip = "2 years", # Normally we do more than one slice, but this speeds up the example slice_limit = 1 ) # Fit and generate resample predictions m750_models_resample <- m750_models %>% modeltime_fit_resamples( resamples = resamples_tscv, control = control_resamples(verbose = TRUE) ) # A new data frame is created from the Modeltime Table # with a column labeled, '.resample_results' m750_models_resample
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.