codez {codez}R Documentation

codez

Description

Seq2seq Time-Feature Analysis using an Encoder-Decoder to project into latent space and a Forward Network to predict the next sequence.

Usage

codez(
  df,
  seq_len = NULL,
  n_windows = 10,
  latent = NULL,
  smoother = FALSE,
  n_samp = 30,
  autoencoder_layers_n = NULL,
  autoencoder_layers_size = NULL,
  autoencoder_activ = NULL,
  forward_net_layers_n = NULL,
  forward_net_layers_size = NULL,
  forward_net_activ = NULL,
  forward_net_reg_L1 = NULL,
  forward_net_reg_L2 = NULL,
  forward_net_drop = NULL,
  loss_metric = "mae",
  autoencoder_optimizer = NULL,
  forward_net_optimizer = NULL,
  epochs = 100,
  patience = 10,
  holdout = 0.5,
  verbose = FALSE,
  ci = 0.8,
  error_scale = "naive",
  error_benchmark = "naive",
  dates = NULL,
  seed = 42
)

Arguments

df

A data frame with time features on columns. They could be numeric variables or categorical, but not both.

seq_len

Positive integer. Time-step number of the forecasting sequence. Default: NULL (random selection within 2 to max preset boundary).

n_windows

Positive integer. Number of validation windows to test prediction error. Default: 10.

latent

Positive integer. Dimensions of the latent space for encoding-decoding operations. Default: NULL (random selection within preset boundaries)

smoother

Logical. Perform optimal smoothing using standard loess for each time feature. Default: FALSE

n_samp

Positive integer. Number of samples for random search. Default: 30.

autoencoder_layers_n

Positive integer. Number of layers for the encoder-decoder model. Default: NULL (random selection within preset boundaries)

autoencoder_layers_size

Positive integer. Numbers of nodes for the encoder-decoder model. Default: NULL (random selection within preset boundaries)

autoencoder_activ

String. Activation function to be used by the encoder-decoder model. Implemented functions are: "linear", "relu", "leaky_relu", "selu", "elu", "sigmoid", "tanh", "swish", "gelu". Default: NULL (random selection within standard activations)

forward_net_layers_n

Positive integer. Number of layers for the forward net model. Default: NULL (random selection within preset boundaries)

forward_net_layers_size

Positive integer. Numbers of nodes for the forward net model. Default: NULL (random selection within preset boundaries)

forward_net_activ

String. Activation function to be used by the forward net model. Implemented functions are: "linear", "relu", "leaky_relu", "selu", "elu", "sigmoid", "tanh", "swish", "gelu". Default: NULL (random selection within standard activations)

forward_net_reg_L1

Positive numeric between. Weights for L1 regularization. Default: NULL (random selection within preset boundaries).

forward_net_reg_L2

Positive numeric between. Weights for L2 regularization. Default: NULL (random selection within preset boundaries).

forward_net_drop

Positive numeric between 0 and 1. Value for the dropout parameter for each layer of the forward net model (for example, a neural net with 3 layers may have dropout = c(0, 0.5, 0.3)). Default: NULL (random selection within preset boundaries).

loss_metric

String. Loss function for both models. Available metrics: "mse", "mae", "mape". Default: "mae".

autoencoder_optimizer

String. Optimization method for autoencoder. Implemented methods are: "adam", "adadelta", "adagrad", "rmsprop", "sgd", "nadam", "adamax". Default: NULL (random selection within standard optimizers).

forward_net_optimizer

String. Optimization method for forward net. Implemented methods are: "adam", "adadelta", "adagrad", "rmsprop", "sgd", "nadam", "adamax". Default: NULL (random selection within standard optimizers).

epochs

Positive integer. Default: 100.

patience

Positive integer. Waiting time (in epochs) before evaluating the overfit performance. Default: 10.

holdout

Positive numeric between 0 and 1. Holdout sample for validation. Default: 0.5.

verbose

Logical. Default: FALSE.

ci

Positive numeric. Confidence interval. Default: 0.8

error_scale

String. Scale for the scaled error metrics (for continuous variables). Two options: "naive" (average of naive one-step absolute error for the historical series) or "deviation" (standard error of the historical series). Default: "naive".

error_benchmark

String. Benchmark for the relative error metrics (for continuous variables). Two options: "naive" (sequential extension of last value) or "average" (mean value of true sequence). Default: "naive".

dates

Date. Vector with dates for time features.

seed

Positive integer. Random seed. Default: 42.

Value

This function returns a list including:

Author(s)

Maintainer: Giancarlo Vercellino giancarlo.vercellino@gmail.com [copyright holder]

Giancarlo Vercellino giancarlo.vercellino@gmail.com

See Also

Useful links:


[Package codez version 1.0.0 Index]