modeltime_wfs_multifit: Fit a workflow_set object over multiple time series

Description Usage Arguments Value Examples

View source: R/modeltime_wfs_multifit.R

Description

allows a workflow_set object to be fitted over multiple time series, using models from the 'modeltime' package.

Usage

1
modeltime_wfs_multifit(serie, .prop, .wfs)

Arguments

serie

nested time series.

.prop

series train/test partition ratio.

.wfs

worklows_set object.

Value

A list of 2 items. The first component is a tibble with a first column that contains the name of the series, and a second column called 'nested_column' that stores the time series, then a column for each workflow for each series are stored. The last 2 columns, 'nested_model' and 'calibration', store the 'n' trained workflows for each series and the adjustment metrics on the test partition. The second element is a tibble saved with the name of 'models_accuracy', it allows to visualize the performance of each workflow for each series according to a set of metrics.

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
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)

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

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