modeltime_wfs_multiforecast: Forecast of a workflow set on multiple time series

Description Usage Arguments Value Examples

View source: R/modeltime_wfs_multiforecast.R

Description

generates forecasts of a workflow set object over multiple time series.

Usage

1
modeltime_wfs_multiforecast(models_table, .h = NULL, .prop = NULL)

Arguments

models_table

a tibble that comes from the output of the modeltime_wfs_multifit(), modeltime_wfs_multirefit(), modeltime_wfs_multibestmodel() functions. For the modeltime_wfs_multifit() function, the 'table_time' object must be selected from the output.

.h

prediction horizon of the modeltime_forecast() function of the 'modeltime' package.

.prop

decimal number, time series split partition ratio. If ".h" is specified, this function predicts on the testing partition.

Value

a tibble, corresponds to the same tibble supplied in the 'models_table' parameter but with an additional column called 'nested_forecast' where the nested previews of the workflows on all the time series are stored.

Examples

 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(dplyr)
library(earth)

df <- sknifedatar::emae_series

datex <- '2020-02-01'
df_emae <- df %>%
  dplyr::filter(date <= datex) %>% 
  tidyr::nest(nested_column=-sector) %>% head(2)

receta_base <- recipes::recipe(value ~ ., data = df %>% select(-sector))

mars <- parsnip::mars(mode = 'regression') %>% parsnip::set_engine('earth')

wfsets <- workflowsets::workflow_set(
  preproc = list(
    R_date = receta_base),
  models  = list(M_mars = mars),
  cross   = TRUE)

wfsets_fit <- sknifedatar::modeltime_wfs_multifit(.wfs = wfsets,
                                                  .prop = 0.8, 
                                                  serie = df_emae)

sknifedatar::modeltime_wfs_multiforecast(wfsets_fit$table_time,
                                         .prop=0.8)

sknifedatar documentation built on June 1, 2021, 9:08 a.m.