prepare_fforma_training_data: Prepare training data for FFORMA

Description Usage Arguments Value Examples

View source: R/META_prepare_fforma_training_data.R

Description

prepare_fforma_training_data is function to prepare a set of training data for the FFORMA meta model, based on a main_forecasting_table. From each row of the main_forecasting_table the ts_object_train is used to generate a set of time series features (using the get_ts_features function), while the fc_errors from that same row are used to determine the best_fc_model. The best_fc_model will be used as the label when training the FFORMA meta model.

Usage

1
prepare_fforma_training_data(main_forecasting_table)

Arguments

main_forecasting_table

A tibble containing a single row and several columns of data required for time series forecasting, which has been created using the create_main_forecasting_table function and which has been extended with the fc_models and fc_errors columns using the add_fc_models_to_main_forecasting_table function.

Value

A tibble that contains the ts_object_train, grouping and ts_split_date columns from the input main_forecasting_table. An additional column that gives the name of the best forecast model (based on MASE) is also included.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
main_forecasting_table <- dummy_gasprice %>%
     tstools::initialize_ts_forecast_data(
     date_col = "year_month",
     col_of_interest = "gasprice",
     group_cols = c("state", "oil_company")
   ) %>%
   create_main_forecasting_table(
      seasonal_periods = NULL,
      min_train_periods = 188
   ) %>%
   add_fc_models_to_main_forecasting_table(
      fc_methods = c("basic", "linear")
   )
prepare_fforma_training_data(main_forecasting_table)

ing-bank/tsforecast documentation built on Sept. 18, 2020, 9:40 a.m.