Skip to main content
For long time in deep learning, sequence modelling was synonymous with recurrent networks, yet several papers have shown that simple convolutional architectures can outperform canonical recurrent networks like LSTMs by demonstrating longer effective memory. By skipping temporal connections the causal convolution filters can be applied to larger time spans while remaining computationally efficient. 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. Visualization of a stack of dilated causal convolutional layers. Figure 1. Visualization of a stack of dilated causal convolutional layers.

TCN

TCN

Bases: BaseModel TCN Temporal Convolution Network (TCN), with MLP decoder. The historical encoder uses dilated skip connections to obtain efficient long memory, while the rest of the architecture allows for future exogenous alignment. Parameters:

TCN.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:

TCN.predict

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

Usage Example