R6 class ModelBuildNNforCaret

R6 class ModelBuildNNforCaret

Value

A dataframe containing the information about the different models

A dataframe containing the hyperparameters for the best model

Methods

Public methods


Method new()

Initialize an object to compare several Univatiate Time Series Models

Usage

ModelBuildNNforCaret$new(
  data = NA,
  var_interest = NA,
  m = NA,
  search = "grid",
  grid = NA,
  tuneLength = NA,
  batch_size = NA,
  h = NA,
  parallel = TRUE,
  seed = 1,
  verbose = 0,
  ...
)

Arguments

data

The dataframe containing the time series realizations (data should not contain time index)

var_interest

The output variable of interest (dependent variable)

m

The frequency of the variable of interest

search

Caret grid search method: 'grid' or 'random' (Default = 'grid')

grid

If search = 'grid', what combinations of hyperparameters to use (See format in vignette). Allowed parameters in grid are "reps", "hd", and "allow.det.season"

tuneLength

If search = 'random', how many random combinations to try (Default = 3)

batch_size

Batch Size to use

h

Forecast Horizon

parallel

Should the grid search be run in parallel or not (Default = TRUE)

seed

The seed to use for training the the Neural Network (Default = 1)

verbose

How much to print during the model building and other processes (Default = 0)

...

Additional parameers to feed to nnfor::mlp function for building the model It is highly recommended to pass the frequency of the variable of interest 'm' to get a good model Other arguments that can be passed can be found by typing ?nnfor::mlp in the console

Returns

A new `ModelBuildNNforCaret` object.


Method get_data()

Returns the time series realization

Usage

ModelBuildNNforCaret$get_data()

Returns

The Time Series Realization


Method summarize_hyperparam_results()

Summarizes the results of all the hyperparameter combinations

Usage

ModelBuildNNforCaret$summarize_hyperparam_results()


Method summarize_best_hyperparams()

Summarizes the best hyperparameter combination

Usage

ModelBuildNNforCaret$summarize_best_hyperparams()


Method plot_hyperparam_results()

Plots the ASE metric variation along the hyperparameter space

Usage

ModelBuildNNforCaret$plot_hyperparam_results(level_plot = TRUE)

Arguments

level_plot

A boolean indicating whether a level plot should be shown. useful for 'grid' search (Default = TRUE).


Method get_final_models()

Returns a final models

Usage

ModelBuildNNforCaret$get_final_models(subset = "a")

Arguments

subset

The subset of models to get. 'a': All models (Default) 'r': Only the recommended models

Returns

If subset = 'a', returns the caret model object If subset = 'r', returns just the nnfor model


Method summarize_build()

Summarizes the entire build process

Usage

ModelBuildNNforCaret$summarize_build(level_plot = TRUE)

Arguments

level_plot

A boolean indicating whether a level plot should be shown. useful for 'grid' search (Default = TRUE).


Method clone()

The objects of this class are cloneable with this method.

Usage

ModelBuildNNforCaret$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.