Skip to main content
The FEDformer model tackles the challenge of finding reliable dependencies on intricate temporal patterns of long-horizon forecasting. The architecture has the following distinctive features:
  • In-built progressive decomposition in trend and seasonal components based on a moving average filter.
  • Frequency Enhanced Block and Frequency Enhanced Attention to perform attention in the sparse representation on basis such as Fourier transform.
  • Classic encoder-decoder proposed by Vaswani et al. (2017) with a multi-head attention mechanism.
The FEDformer model utilizes a three-component approach to define its embedding:
  • It employs encoded autoregressive features obtained from a convolution network.
  • Absolute positional embeddings obtained from calendar features are utilized.
References Figure 1. FEDformer Architecture. Figure 1. FEDformer Architecture.

1. FEDformer

FEDformer

Bases: BaseModel FEDformer The FEDformer model tackles the challenge of finding reliable dependencies on intricate temporal patterns of long-horizon forecasting. The architecture has the following distinctive features:
  • In-built progressive decomposition in trend and seasonal components based on a moving average filter.
  • Frequency Enhanced Block and Frequency Enhanced Attention to perform attention in the sparse representation on basis such as Fourier transform.
  • Classic encoder-decoder proposed by Vaswani et al. (2017) with a multi-head attention mechanism.
The FEDformer model utilizes a three-component approach to define its embedding:
  • It employs encoded autoregressive features obtained from a convolution network.
  • Absolute positional embeddings obtained from calendar features are utilized.
Parameters:

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

FEDformer.predict

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

Usage Example

2. Auxiliary functions

AutoCorrelationLayer

Bases: Module Auto Correlation Layer

LayerNorm

Bases: Module Special designed layernorm for the seasonal part

Decoder

Bases: Module FEDformer decoder

DecoderLayer

Bases: Module FEDformer decoder layer with the progressive decomposition architecture

Encoder

Bases: Module FEDformer encoder

EncoderLayer

Bases: Module FEDformer encoder layer with the progressive decomposition architecture

FourierCrossAttention

Bases: Module Fourier Cross Attention layer

FourierBlock

Bases: Module Fourier block

FourierBlock.compl_mul1d

FourierBlock.forward

FourierBlock.index

FourierBlock.scale

FourierBlock.weights1

get_frequency_modes