This is a boilerplate function to automatically create the following:
recipe
model specification
workflow
tuned model (grid ect)
calibration tibble and plot
Usage
ts_auto_smooth_es(
.data,
.date_col,
.value_col,
.formula,
.rsamp_obj,
.prefix = "ts_smooth_es",
.tune = TRUE,
.grid_size = 10,
.num_cores = 1,
.cv_assess = 12,
.cv_skip = 3,
.cv_slice_limit = 6,
.best_metric = "rmse",
.bootstrap_final = FALSE
)Arguments
- .data
The data being passed to the function. The time-series object.
- .date_col
The column that holds the datetime.
- .value_col
The column that has the value
- .formula
The formula that is passed to the recipe like
value ~ .- .rsamp_obj
The rsample splits object
- .prefix
Default is
ts_smooth_es- .tune
Defaults to TRUE, this creates a tuning grid and tuned model.
- .grid_size
If
.tuneis TRUE then the.grid_sizeis the size of the tuning grid.- .num_cores
How many cores do you want to use. Default is 1
- .cv_assess
How many observations for assess. See
timetk::time_series_cv()- .cv_skip
How many observations to skip. See
timetk::time_series_cv()- .cv_slice_limit
How many slices to return. See
timetk::time_series_cv()- .best_metric
Default is "rmse". See
modeltime::default_forecast_accuracy_metric_set()- .bootstrap_final
Not yet implemented.
Details
This uses modeltime::exp_smoothing() and sets the parsnip::engine
to smooth_es.
See also
https://business-science.github.io/modeltime/reference/exp_smoothing.html#ref-examples
https://github.com/config-i1/smooth
Other Boiler_Plate:
ts_auto_arima(),
ts_auto_arima_xgboost(),
ts_auto_croston(),
ts_auto_exp_smoothing(),
ts_auto_glmnet(),
ts_auto_lm(),
ts_auto_mars(),
ts_auto_nnetar(),
ts_auto_prophet_boost(),
ts_auto_prophet_reg(),
ts_auto_svm_poly(),
ts_auto_svm_rbf(),
ts_auto_theta(),
ts_auto_xgboost()
Other exp_smoothing:
ts_auto_croston(),
ts_auto_exp_smoothing(),
ts_auto_theta()
Examples
# \donttest{
library(dplyr)
library(timetk)
library(modeltime)
data <- AirPassengers %>%
ts_to_tbl() %>%
select(-index)
splits <- time_series_split(
data
, date_col
, assess = 12
, skip = 3
, cumulative = TRUE
)
ts_smooth_es <- ts_auto_smooth_es(
.data = data,
.num_cores = 2,
.date_col = date_col,
.value_col = value,
.rsamp_obj = splits,
.formula = value ~ .,
.grid_size = 3,
.tune = FALSE
)
#> Error in fit_xy(spec, x = mold$predictors, y = mold$outcomes, case_weights = case_weights, control = control_parsnip): Please install the smooth package to use this engine.
ts_smooth_es$recipe_info
#> Error: object 'ts_smooth_es' not found
# }
