forecast from a set of recipes and models trained by modeltime_wfs_fit() function.

modeltime_wfs_forecast(.wfs_results, .series, .split_prop = NULL, .h = NULL)

Arguments

.wfs_results

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

.series

time series dataframe.

.split_prop

time series split proportion.

.h

time series horizon from the modeltime_forecast() function from 'modeltime' package.

Value

a tibble containing the forecast for each model.

Details

since it uses the modeltime_forecast() function from 'modeltime' package, either the forecast can be made on new data or on a number of periods.

Examples

library(dplyr) library(modeltime) 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)
#> ── MODEL: R_date_M_mars
#> Training finished OK.
#>
#>
#> ── 1 models fitted ♥ ───────────────────────────────────────────────────────────
#>
#> ── 0 models deleted x ──
#>
sknifedatar::modeltime_wfs_forecast(.wfs_results=wffits, .series = data, .split_prop = 0.8)
#> # A tibble: 1,497 x 7 #> .model_id .model_desc .key .index .value .conf_lo .conf_hi #> <chr> <chr> <fct> <date> <dbl> <dbl> <dbl> #> 1 NA ACTUAL actual 2009-01-01 76167 NA NA #> 2 NA ACTUAL actual 2009-01-02 102293 NA NA #> 3 NA ACTUAL actual 2009-01-03 81249 NA NA #> 4 NA ACTUAL actual 2009-01-04 79140 NA NA #> 5 NA ACTUAL actual 2009-01-05 123039 NA NA #> 6 NA ACTUAL actual 2009-01-06 120033 NA NA #> 7 NA ACTUAL actual 2009-01-07 124016 NA NA #> 8 NA ACTUAL actual 2009-01-08 123795 NA NA #> 9 NA ACTUAL actual 2009-01-09 132735 NA NA #> 10 NA ACTUAL actual 2009-01-10 90502 NA NA #> # … with 1,487 more rows