View source: R/modeltime-table.R
modeltime_table | R Documentation |
Designed to perform forecasts at scale using models created with
modeltime
, parsnip
, workflows
, and regression modeling extensions
in the tidymodels
ecosystem.
modeltime_table(...)
as_modeltime_table(.l)
... |
Fitted |
.l |
A list containing fitted |
modeltime_table()
:
Creates a table of models
Validates that all objects are models (parsnip or workflows objects) and all models have been fitted (trained)
Provides an ID and Description of the models
as_modeltime_table()
:
Converts a list
of models to a modeltime table. Useful if programatically creating
Modeltime Tables from models stored in a list
.
library(dplyr)
library(timetk)
library(parsnip)
library(rsample)
# Data
m750 <- m4_monthly %>% filter(id == "M750")
# Split Data 80/20
splits <- initial_time_split(m750, prop = 0.9)
# --- MODELS ---
# Model 1: prophet ----
model_fit_prophet <- prophet_reg() %>%
set_engine(engine = "prophet") %>%
fit(value ~ date, data = training(splits))
# ---- MODELTIME TABLE ----
# Make a Modeltime Table
models_tbl <- modeltime_table(
model_fit_prophet
)
# Can also convert a list of models
list(model_fit_prophet) %>%
as_modeltime_table()
# ---- CALIBRATE ----
calibration_tbl <- models_tbl %>%
modeltime_calibrate(new_data = testing(splits))
# ---- ACCURACY ----
calibration_tbl %>%
modeltime_accuracy()
# ---- FORECAST ----
calibration_tbl %>%
modeltime_forecast(
new_data = testing(splits),
actual_data = m750
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.