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.
unique_id | ds | y | |
---|---|---|---|
9904 | 1 | 9904 | -0.951057 |
9905 | 1 | 9905 | -0.570326 |
9906 | 1 | 9906 | -0.391007 |
9907 | 1 | 9907 | -0.499087 |
9908 | 1 | 9908 | -0.809017 |
… | … | … | … |
9995 | 1 | 9995 | -0.029130 |
9996 | 1 | 9996 | -0.309017 |
9997 | 1 | 9997 | -0.586999 |
9998 | 1 | 9998 | -0.656434 |
9999 | 1 | 9999 | -0.432012 |
3. NHITS decomposition
We will employNHITS
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 employNBEATSx
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”.