tune_keras_rnn_eval: Evaluate (tuned) recurrent neural networks per...

Description Usage Arguments Value See Also Examples

View source: R/tune_keras_rnn_eval.R

Description

Evaluate (tuned) recurrent neural networks per cross-validation split/sample for time series data

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
tune_keras_rnn_eval(
  fc_sample,
  cv_setting,
  bayes_best_par,
  col_id = NULL,
  col_date = "index",
  col_value = "value",
  h = NULL,
  frequency = 4,
  level = 95
)

Arguments

fc_sample

forecasts per rsample split

cv_setting

list of "periods_train", "periods_val", "periods_test" and "skip_span" for rolling_origin

bayes_best_par

tuned hyperparameters, from tune_keras_rnn_bayesoptim()

col_id

Optional ID column in data, default to "ticker"

col_date

Date column in data, default to "index"

col_value

Value column in data, default to "value"

h

NULL if forecast horizon equals cv_setting$n_test, else named list of forecast horizons for accuracy measures

frequency

time series frequency, e.g. 4 for quarters and 12 for months

level

level for prediction interval in percentage

Value

list of time series accuracy measures (MAPE, sMAPE, MASE, sMIS, ACD) optionally for different forecast horizons (if h specified)

See Also

Other RNN tuning with Keras: tune_keras_rnn_bayesoptim(), tune_keras_rnn_predict()

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
28
result_predict <- readRDS(system.file(
"tinytest_data/test_tune_keras_rnn_predict_simple.rds", package = "tsRNN"
))
cv_setting <- list(
  periods_train = 90,
  periods_val = 10,
  periods_test = 10,
  skip_span = 5
)
bayes_best_par <- purrr::map(
  readRDS(system.file("tinytest_data/apple_bayesoptim.rds", package = "tsRNN")),
  "Best_Par"
)

# Result
tune_keras_rnn_eval(
  fc_sample = result_predict,
  cv_setting = cv_setting,
  bayes_best_par = bayes_best_par
)

# Specify multiple forecast horizons
tune_keras_rnn_eval(
  fc_sample = result_predict,
  cv_setting = cv_setting,
  bayes_best_par = bayes_best_par,
  h = list(short = 1:2, long = 3:6)
)

thfuchs/tsRNN documentation built on April 17, 2021, 11:03 p.m.