new_modeltime_bridge function

Constructor for creating modeltime models

Constructor for creating modeltime models

These functions are used to construct new modeltime bridge functions that connect the tidymodels infrastructure to time-series models containing date or date-time features.

new_modeltime_bridge(class, models, data, extras = NULL, desc = NULL)

Arguments

  • class: A class name that is used for creating custom printing messages
  • models: A list containing one or more models
  • data: A data frame (or tibble) containing 4 columns: (date column with name that matches input data), .actual, .fitted, and .residuals.
  • extras: An optional list that is typically used for transferring preprocessing recipes to the predict method.
  • desc: An optional model description to appear when printing your modeltime objects

Examples

library(dplyr) library(lubridate) library(timetk) lm_model <- lm(value ~ as.numeric(date) + hour(date) + wday(date, label = TRUE), data = taylor_30_min) data = tibble( date = taylor_30_min$date, # Important - The column name must match the modeled data # These are standardized names: .actual, .fitted, .residuals .actual = taylor_30_min$value, .fitted = lm_model$fitted.values %>% as.numeric(), .residuals = lm_model$residuals %>% as.numeric() ) new_modeltime_bridge( class = "lm_time_series_impl", models = list(model_1 = lm_model), data = data, extras = NULL )