modeltime_wfs_refit: Modeltime workflow sets refit

Description Usage Arguments Details Value Examples

View source: R/modeltime_wfs_refit.R

Description

applies the modeltime_refit() function from 'modeltime' package to the object generated from the modeltime_wfs_fit() function (or the filtered version after the modeltime_wfs_bestmodel() is applied).

Usage

1
modeltime_wfs_refit(.wfs_results, .serie)

Arguments

.wfs_results

tibble of combination of recipes and models fitted, generated with the modeltime_wfs_fit() function.

.serie

a time series dataframe.

Details

each workflow is now re-trained using all the available data.

Value

a tibble containing the re-trained models.

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

data <- sknifedatar::data_avellaneda %>% 
  mutate(date=as.Date(date)) %>% 
  filter(date<'2012-06-01')

recipe_date <- recipes::recipe(value ~ ., data = data) %>% 
  recipes::step_date(date, features = c('dow','doy','week','month','year')) 

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

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

wffits <- sknifedatar::modeltime_wfs_fit(.wfsets = wfsets, 
                                         .split_prop = 0.8, 
                                         .serie = data)

sknifedatar::modeltime_wfs_refit(.wfs_results = wffits,
                                 .serie = data)
                               

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