tune_keras_rnn_predict: Automatic cross-validated training and prediction process for...

Description Usage Arguments Value See Also Examples

View source: R/tune_keras_rnn_predict.R

Description

Use tuned RNN parameters with Keras functional API to train best performing model(s) and generate forecasts

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
tune_keras_rnn_predict(
  data,
  model_type,
  cv_setting,
  bayes_best_par,
  col_id = NULL,
  col_date = "index",
  col_value = "value",
  level = 95,
  iter = 10,
  iter_dropout = 1000,
  save_model = NULL,
  save_model_id = NULL
)

Arguments

data

Univariate time series (data.frame) with date and value column, specified in col_date and col_value

model_type

One of "simple", "gru" or "lstm"

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"

level

level for prediction interval in percentage

iter

number of neural networks to train per split with same hyperparameters

iter_dropout

number of iterations for prediction intervals calculated by monte carlo dropout

save_model

Automatically save tuned models? Specify NULL for No or character vector with path to directory for yes

save_model_id

optional id for model filename

Value

list of forecasts per split

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
apple <- tsRNN::DT_apple

bayes_best_par <- purrr::map(
  readRDS(system.file("tinytest_data/apple_bayesoptim.rds", package = "tsRNN")),
  "Best_Par"
)
cv_setting <- list(
  periods_train = 90,
  periods_val = 10,
  periods_test = 10,
  skip_span = 5
)

result <- tune_keras_rnn_predict(
  data = apple,
  model_type = "simple",
  cv_setting = cv_setting,
  bayes_best_par = bayes_best_par
)
result

## End(Not run)

thfuchs/fcf documentation built on April 18, 2021, 1:43 p.m.