View source: R/calibrate-plot-list.R
calibrate_and_plot | R Documentation |
This function is a helper function. It will take in a set of workflows and then
perform the modeltime::modeltime_calibrate()
and modeltime::plot_modeltime_forecast()
.
calibrate_and_plot(
...,
.type = "testing",
.splits_obj,
.data,
.print_info = TRUE,
.interactive = FALSE
)
... |
The workflow(s) you want to add to the function. |
.type |
Either the training(splits) or testing(splits) data. |
.splits_obj |
The splits object. |
.data |
The full data set. |
.print_info |
The default is TRUE and will print out the calibration accuracy tibble and the resulting plotly plot. |
.interactive |
The defaults is FALSE. This controls if a forecast plot is interactive or not via plotly. |
This function expects to take in workflows fitted with training data.
The original time series, the simulated values and a some plots
Steven P. Sanderson II, MPH
Other Utility:
auto_stationarize()
,
internal_ts_backward_event_tbl()
,
internal_ts_both_event_tbl()
,
internal_ts_forward_event_tbl()
,
model_extraction_helper()
,
ts_get_date_columns()
,
ts_info_tbl()
,
ts_is_date_class()
,
ts_lag_correlation()
,
ts_model_auto_tune()
,
ts_model_compare()
,
ts_model_rank_tbl()
,
ts_model_spec_tune_template()
,
ts_qq_plot()
,
ts_scedacity_scatter_plot()
,
ts_to_tbl()
,
util_difflog_ts()
,
util_doublediff_ts()
,
util_doubledifflog_ts()
,
util_log_ts()
,
util_singlediff_ts()
## Not run:
suppressPackageStartupMessages(library(timetk))
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(recipes))
suppressPackageStartupMessages(library(rsample))
suppressPackageStartupMessages(library(parsnip))
suppressPackageStartupMessages(library(workflows))
data <- ts_to_tbl(AirPassengers) %>%
select(-index)
splits <- timetk::time_series_split(
data
, date_col
, assess = 12
, skip = 3
, cumulative = TRUE
)
rec_obj <- recipe(value ~ ., data = training(splits))
model_spec <- linear_reg(
mode = "regression"
, penalty = 0.1
, mixture = 0.5
) %>%
set_engine("lm")
wflw <- workflow() %>%
add_recipe(rec_obj) %>%
add_model(model_spec) %>%
fit(training(splits))
output <- calibrate_and_plot(
wflw
, .type = "training"
, .splits_obj = splits
, .data = data
, .print_info = FALSE
, .interactive = FALSE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.