Learn R Programming

sknifedatar (version 0.1.2)

modeltime_wfs_forecast: Modeltime workflow sets forecast

Description

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

Usage

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

Run this code
# NOT RUN {
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)
                            
sknifedatar::modeltime_wfs_forecast(.wfs_results=wffits, 
                                    .series = data,
                                    .split_prop = 0.8) 
                                     
# }

Run the code above in your browser using DataLab