Skip to main content
Bidirectional Temporal Convolutional Network (BiTCN) is a forecasting architecture based on two temporal convolutional networks (TCNs). The first network (‘forward’) encodes future covariates of the time series, whereas the second network (‘backward’) encodes past observations and covariates. This method allows to preserve the temporal information of sequence data, and is computationally more efficient than common RNN methods (LSTM, GRU, …). As compared to Transformer-based methods, BiTCN has a lower space complexity, i.e. it requires orders of magnitude less parameters. This model may be a good choice if you seek a small model (small amount of trainable parameters) with few hyperparameters to tune (only 2). References Figure 1. Visualization of a stack of dilated causal convolutional layers. Figure 1. Visualization of a stack of dilated causal convolutional layers.

1. BiTCN

BiTCN

Bases: BaseModel BiTCN Bidirectional Temporal Convolutional Network (BiTCN) is a forecasting architecture based on two temporal convolutional networks (TCNs). The first network (‘forward’) encodes future covariates of the time series, whereas the second network (‘backward’) encodes past observations and covariates. This is a univariate model. Parameters:

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

BiTCN.predict

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

Usage Example

2. Auxilary functions

TCNCell

Bases: Module Temporal Convolutional Network Cell, consisting of CustomConv1D modules.

CustomConv1d

Bases: Module Forward- and backward looking Conv1D