Skip to main content
Cho et. al proposed the Gated Recurrent Unit (GRU) to improve on LSTM and Elman cells. The predictions at each time are given by a MLP decoder. This architecture follows closely the original Multi Layer Elman RNN with the main difference being its use of the GRU cells. The predictions are obtained by transforming the hidden states into contexts c[t+1:t+H]\mathbf{c}_{[t+1:t+H]}, that are decoded and adapted into y^[t+1:t+H],[q]\mathbf{\hat{y}}_{[t+1:t+H],[q]} through MLPs. where ht\mathbf{h}_{t}, is the hidden state for time tt, yt\mathbf{y}_{t} is the input at time tt and ht1\mathbf{h}_{t-1} is the hidden state of the previous layer at t1t-1, x(s)\mathbf{x}^{(s)} are static exogenous inputs, xt(h)\mathbf{x}^{(h)}_{t} historic exogenous, x[:t+H](f)\mathbf{x}^{(f)}_{[:t+H]} are future exogenous available at the time of the prediction. References Figure 1. Gated Recurrent Unit Cell. Figure 1. Gated Recurrent Unit Cell.

GRU

GRU

Bases: BaseModel GRU Multi Layer Recurrent Network with Gated Units (GRU), and MLP decoder. The network has non-linear activation functions, it is trained using ADAM stochastic gradient descent. The network accepts static, historic and future exogenous data, flattens the inputs. Parameters:

GRU.fit

Fit. The fit method, optimizes the neural network’s weights using the initialization parameters (learning_rate, windows_batch_size, …) and the loss function as defined during the initialization. Within fit we use a PyTorch Lightning Trainer that inherits the initialization’s self.trainer_kwargs, to customize its inputs, see PL’s trainer arguments. The method is designed to be compatible with SKLearn-like classes and in particular to be compatible with the StatsForecast library. By default the model is not saving training checkpoints to protect disk memory, to get them change enable_checkpointing=True in __init__. Parameters: Returns:

GRU.predict

Predict. Neural network prediction with PL’s Trainer execution of predict_step. Parameters: Returns:

Usage Example