Interpretable Decompositions
Time series signal decomposition involves breaking down an original time series into its constituent components. By decomposing the time series, we can gain insights into underlying patterns, trends-cycles, and seasonal effects, enabling improved understanding and forecasting accuracy.
This notebook will show how to use the
NHITS
/NBEATSx
to extract these series’ components. We will:
- Installing
NeuralForecast.
- Simulate a Harmonic Signal.
- NHITS’ forecast
decomposition.
- NBEATSx’ forecast decomposition.
You can run these experiments using GPU with Google Colab.
1. Installing NeuralForecast
2. Simulate a Harmonic Signal
In this example, we will consider a Harmonic signal comprising two frequencies: one low-frequency and one high-frequency.
index | unique_id | ds | y | |
---|---|---|---|---|
0 | 9904 | 1 | 9904 | -0.951057 |
1 | 9905 | 1 | 9905 | -0.570326 |
2 | 9906 | 1 | 9906 | -0.391007 |
3 | 9907 | 1 | 9907 | -0.499087 |
4 | 9908 | 1 | 9908 | -0.809017 |
… | … | … | … | … |
91 | 9995 | 1 | 9995 | -0.029130 |
92 | 9996 | 1 | 9996 | -0.309017 |
93 | 9997 | 1 | 9997 | -0.586999 |
94 | 9998 | 1 | 9998 | -0.656434 |
95 | 9999 | 1 | 9999 | -0.432012 |
3. NHITS decomposition
We will employ
NHITS
stack-specialization to recover the latent harmonic functions.
NHITS
,
a Wavelet-inspired algorithm, allows for breaking down a time series
into various scales or resolutions, aiding in the identification of
localized patterns or features. The expressivity ratios for each layer
enable control over the model’s stack specialization.
4. NBEATSx decomposition
Here we will employ
NBEATSx
interpretable basis projection to recover the latent harmonic functions.
NBEATSx
,
this network in its interpretable variant sequentially projects the
signal into polynomials and harmonic basis to learn trend and
seasonality components:
In contrast to
NHITS
’
wavelet-like projections the basis heavily determine the behavior of the
projections. And the Fourier projections are not capable of being
immediately decomposed into individual frequencies.
References
- Cristian Challu, Kin G. Olivares, Boris N. Oreshkin, Federico
Garza, Max Mergenthaler-Canseco, Artur Dubrawski (2023). NHITS:
Neural Hierarchical Interpolation for Time Series
Forecasting.
- Boris N. Oreshkin, Dmitri Carpov, Nicolas Chapados, Yoshua Bengio
(2019). “N-BEATS: Neural basis expansion analysis for interpretable
time series forecasting”.
- Kin G. Olivares, Cristian Challu, Grzegorz Marcjasz, Rafał Weron, Artur Dubrawski (2021). “Neural basis expansion analysis with exogenous variables: Forecasting electricity prices with NBEATSx”.