![Revisit consent button](../images/body-df29beacd7496220cc94.svg)
We value your privacy
We use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking "Accept All", you consent to our use of cookies.
Customise Reject All Accept All
Customise Consent Preferences ![](../images/body-2159bb67f3de8ad870eb.svg)
We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.
The cookies that are categorised as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more
NecessaryAlways Active
Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.
  * Cookie
BCTempID
  * Duration
10 minutes
  * Description
No description available.


  * Cookie
__cf_bm
  * Duration
1 hour
  * Description
This cookie, set by Cloudflare, is used to support Cloudflare Bot Management. 


  * Cookie
AWSALBCORS
  * Duration
7 days
  * Description
Amazon Web Services set this cookie for load balancing.


  * Cookie
_cfuvid
  * Duration
session
  * Description
Cloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services


  * Cookie
li_gc
  * Duration
6 months
  * Description
Linkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.


  * Cookie
__hssrc
  * Duration
session
  * Description
This cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.


  * Cookie
__hssc
  * Duration
1 hour
  * Description
HubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.


  * Cookie
wpEmojiSettingsSupports
  * Duration
session
  * Description
WordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.


  * Cookie
BCSessionID
  * Duration
1 year 1 month 4 days
  * Description
Blueconic sets this cookie as a unique identifier for the BlueConic profile.


  * Cookie
_octo
  * Duration
1 year
  * Description
No description available.


  * Cookie
logged_in
  * Duration
1 year
  * Description
No description available.


  * Cookie
__Secure-YEC
  * Duration
past
  * Description
YouTube sets this cookie to stores the user's video player preferences using embedded YouTube video


  * Cookie
__eoi
  * Duration
6 months
  * Description
Description is currently not available.


  * Cookie
AWSALBTGCORS
  * Duration
7 days
  * Description
No description available.


  * Cookie
login-status-p
  * Duration
past
  * Description
Description is currently not available.


  * Cookie
AWSALBTG
  * Duration
7 days
  * Description
No description available.


  * Cookie
csrf_token
  * Duration
session
  * Description
No description available.


  * Cookie
token_v2
  * Duration
1 day
  * Description
Description is currently not available.


  * Cookie
D
  * Duration
1 year
  * Description
Description is currently not available.


  * Cookie
PHPSESSID
  * Duration
session
  * Description
This cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.


  * Cookie
VISITOR_PRIVACY_METADATA
  * Duration
6 months
  * Description
YouTube sets this cookie to store the user's cookie consent state for the current domain. 


  * Cookie
cookietest
  * Duration
session
  * Description
The cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.


  * Cookie
__Host-airtable-session
  * Duration
1 year
  * Description
This cookie is used to enable us to integrate the services of Airtable.


  * Cookie
__Host-airtable-session.sig
  * Duration
1 year
  * Description
This cookie is used to enable us to integrate the services of Airtable.


  * Cookie
m
  * Duration
1 year 1 month 4 days
  * Description
Stripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.


  * Cookie
BIGipServer*
  * Duration
session
  * Description
Marketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. 


  * Cookie
__cfruid
  * Duration
session
  * Description
Cloudflare sets this cookie to identify trusted web traffic.


  * Cookie
_GRECAPTCHA
  * Duration
6 months
  * Description
Google Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.


  * Cookie
__Secure-YNID
  * Duration
6 months
  * Description
Google cookie used to protect user security and prevent fraud, especially during the login process.


  * Cookie
cookieyes-consent
  * Duration
1 year
  * Description
CookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.


Functional
Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.
  * Cookie
lidc
  * Duration
1 day
  * Description
LinkedIn sets the lidc cookie to facilitate data center selection.


  * Cookie
brw
  * Duration
1 year
  * Description
No description available.


  * Cookie
brwConsent
  * Duration
5 minutes
  * Description
Description is currently not available.


  * Cookie
WMF-Uniq
  * Duration
1 year
  * Description
Description is currently not available.


  * Cookie
loom_anon_comment
  * Duration
1 year
  * Description
No description available.


  * Cookie
loom_referral_video
  * Duration
session
  * Description
Description is currently not available.


  * Cookie
VISITOR_INFO1_LIVE
  * Duration
6 months
  * Description
A cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.


  * Cookie
yt-remote-connected-devices
  * Duration
Never Expires
  * Description
YouTube sets this cookie to store the user's video preferences using embedded YouTube videos.


  * Cookie
ytidb::LAST_RESULT_ENTRY_KEY
  * Duration
Never Expires
  * Description
The cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.


  * Cookie
yt-remote-device-id
  * Duration
Never Expires
  * Description
YouTube sets this cookie to store the user's video preferences using embedded YouTube videos.


  * Cookie
yt-remote-session-name
  * Duration
session
  * Description
The yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.


  * Cookie
yt-remote-fast-check-period
  * Duration
session
  * Description
The yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.


  * Cookie
yt-remote-session-app
  * Duration
session
  * Description
The yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.


  * Cookie
yt-remote-cast-available
  * Duration
session
  * Description
The yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.


  * Cookie
yt-remote-cast-installed
  * Duration
session
  * Description
The yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.


  * Cookie
cp_session
  * Duration
3 months
  * Description
Codepen sets this cookie for Help systems found in the website.


  * Cookie
loid
  * Duration
1 year 1 month 4 days
  * Description
This cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.


Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.
  * Cookie
__hstc
  * Duration
6 months
  * Description
Hubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).


  * Cookie
hubspotutk
  * Duration
6 months
  * Description
HubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.


  * Cookie
_ga
  * Duration
1 year 1 month 4 days
  * Description
Google Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.


  * Cookie
_ga_*
  * Duration
1 year 1 month 4 days
  * Description
Google Analytics sets this cookie to store and count page views.


  * Cookie
__Host-psifi.analyticsTrace
  * Duration
6 hours
  * Description
Description is currently not available.


  * Cookie
__Host-psifi.analyticsTraceV2
  * Duration
6 hours
  * Description
Description is currently not available.


  * Cookie
_gh_sess
  * Duration
session
  * Description
GitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.


  * Cookie
YSC
  * Duration
session
  * Description
YSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.


  * Cookie
ajs_anonymous_id
  * Duration
1 year
  * Description
This cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.


  * Cookie
vuid
  * Duration
1 year 1 month 4 days
  * Description
Vimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. 


Performance
Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.
  * Cookie
AWSALB
  * Duration
7 days
  * Description
AWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.


  * Cookie
acq
  * Duration
past
  * Description
Description is currently not available.


  * Cookie
acq.sig
  * Duration
past
  * Description
Description is currently not available.


  * Cookie
ptc
  * Duration
2 years
  * Description
No description available.


Advertisement
Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.
  * Cookie
muc_ads
  * Duration
1 year 1 month 4 days
  * Description
Twitter sets this cookie to collect user behaviour and interaction data to optimize the website.


  * Cookie
guest_id_marketing
  * Duration
1 year 1 month 4 days
  * Description
Twitter sets this cookie to identify and track the website visitor.


  * Cookie
guest_id_ads
  * Duration
1 year 1 month 4 days
  * Description
Twitter sets this cookie to identify and track the website visitor.


  * Cookie
personalization_id
  * Duration
1 year 1 month 4 days
  * Description
Twitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.


  * Cookie
guest_id
  * Duration
1 year 1 month 4 days
  * Description
Twitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.


  * Cookie
bcookie
  * Duration
1 year
  * Description
LinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.


  * Cookie
__Secure-ROLLOUT_TOKEN
  * Duration
6 months
  * Description
YouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.


  * Cookie
yt.innertube::nextId
  * Duration
Never Expires
  * Description
YouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.


  * Cookie
yt.innertube::requests
  * Duration
Never Expires
  * Description
YouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.


  * Cookie
session_tracker
  * Duration
session
  * Description
This cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.


  * Cookie
edgebucket
  * Duration
session
  * Description
Reddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.


  * Cookie
did
  * Duration
1 year
  * Description
Arbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.


Uncategorised
Other uncategorised cookies are those that are being analysed and have not been classified into a category as yet.
No cookies to display.
Reject All Save My Preferences Accept All
Toggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation
[](https://towardsdatascience.com/)
Publish AI, ML & data-science insights to a global community of data professionals.
Sign in[Submit an Article](https://write.insightmediagroup.io)
[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)
* * *
[Write For TDS](https://towardsdatascience.com/submissions/)
[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search
[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)
# N-BEATS : Time-Series Forecasting with Neural Basis Expansion
A Deep Learning model that provides accuracy and interpretability
[Nikos Kafritsas](https://towardsdatascience.com/author/nikoskafritsas/)
November 25, 202212 min read
# N-BEATS: Time-Series Forecasting with Neural Basis Expansion
### A Deep Learning model for zero-shot time-series forecasting
![Created with DALLE \[1\]](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/11/1Yacgnk0WblMoYTvCTDpvJw.png)
Created with DALLE [1]
**There's one thing that makes Time-Series Forecasting special.**
It was the only area of Data Science where Deep Learning and Transformers didn't decisively outperform the other models.
Let's use the prestigious **Makridakis M-competitions** as a benchmark - a series of large-scale challenges that showcase the latest advances in the time-series forecasting area.
In the fourth iteration of the competition, known as **M4** , the winning solution was [ES-RNN [2]](https://eng.uber.com/m4-forecasting-competition/), a hybrid LSTM & Exponential Smoothing model developed by Uber. Interestingly, the 6 (out of 57) pure ML models performed so poorly, they barely surpassed the competition baseline.
Learn this step by step with the interactive [AI Engineer](https://roadmap.sh/ai-engineer), [AI and Data Scientist](https://roadmap.sh/ai-data-scientist), [Machine Learning](https://roadmap.sh/machine-learning) and [Computer Science](https://roadmap.sh/computer-science) roadmaps.
That changed one year later. _Elemental AI_ (co-founded by **Yoshua Bengio**) published [**N-BEATS [3]**](https://arxiv.org/pdf/1905.10437.pdf)_**,**_ a pure Deep-Learning model that outperformed the winning ES-RNN model of M4 by 3%. But there's more.
In this article, we describe in depth:
  1. **The architecture of** _**N-BEATS**_**, how the model works, and why is so powerful.**
  2. **How** _**N-BEATS**_**produces interpretable forecasts.**
  3. **How** _**N-BEATS**_**achieves unparallel zero-shot transfer learning.**
  4. **Why** _**ARIMA**_**cannot natively support transfer learning.**


Let's dive in.
> I've launched [**AI Horizon Forecast**](https://aihorizonforecast.substack.com/)**,** a newsletter focusing on time-series and innovative AI research. Subscribe [here](https://aihorizonforecast.substack.com/) to broaden your horizons!
## What is N-BEATS
> N-BEATS is a fast, interpretable DL model that recreates the mechanisms of statistical models using double residual stacks of fully connected layers.
**N-BEATS** stands for _**N**_ _eural_ _**B**_ _asis_ _**E**_ _xpansion_ _**A**_ _nalysis for_ _**T**_ _ime_ _**S**_ _eries,_ a revolutionary model created by **ElementAI.** This company was co-founded by **Yoshua Bengio** and was later acquired by [ServiceNow](https://en.wikipedia.org/wiki/ServiceNow).
_N-BEATS_ **** is an interesting forecasting model because:
  * It is the first pure Deep Learning model that outperformed all well-established statistical approaches.
  * It provides interpretable forecasts.
  * It sets the basis for **Transfer Learning** on time series.


Around that time, **Amazon** published its novel time-series model, known as [**DeepAR [4]**](https://arxiv.org/pdf/1704.04110.pdf)**.** Although _DeepAR_ contains __ Deep Learning components, the model employs a few statistical concepts as well (maximum likelihood estimation).
## N-BEATS - Overview
Let's briefly discuss a few key traits of _N-BEATS_ :
  * **Multiple time-series support** : _N-BEATS_ can be trained on multiple time series, each one representing a different distribution.
  * **Fast Training:** The model does not contain any Recurrent or self-attention layers - thus, faster training & stable gradient flow.
  * **Multi-horizon forecasting** : The model produces multi-step predictions.
  * **Interpretability:** The authors developed 2 model versions, the _**generic**_ version, and the _**interpretable**_ version. The interpretable version can output interpretable predictions, regarding trend and seasonality.
  * **Zero-shot Transfer Learning:** The model can transfer its knowledge to other time-series datasets with astounding success.


> **Note:** The original N-BEATS implementation by ElementAI works on univariate time-series only. The Darts library has released an updated version that supports multivariate time-series and probabilistic outputs. In this article, we focus on the original version.
## N-BEATS - Generic Architecture
The _N-BEATS_ architecture is deep, yet very simple. **Figure 1** displays the top-level view:
![Figure 1: The top-level architecture of N-BEATS \(Source\)](../images/001.png)
**Figure 1:** The top-level architecture of N-BEATS ([Source](https://arxiv.org/pdf/1905.10437.pdf))
Notice 3 things:
  1. The _**block**_ (blue color) - the basic processing unit.
  2. The _**stack**_ (orange color) - a collection of blocks.
  3. The _**final model**_ (yellow color) - a collection of stacks.


Every neural network layer in the model is just a dense (fully-connected) layer.
Let's start with the first component, the basic block:
### 1. The Basic Block
Suppose `H` is the forecasting horizon. In _N-BEATS_ , the lookback window is a multiple of the horizon `H` .
**Figure 2** displays the architecture of the basic block:
![Figure 2: The basic Block architecture \(Source\)](../images/002.png)
**Figure 2:** The basic Block architecture ([Source](https://arxiv.org/pdf/1905.10437.pdf))
Let's take a look under the hood.
In **Figure 3,** we **** use the parameters of the paper's benchmark from the** Electricity dataset [5**]:
![Figure 3: All operations inside the basic Block \(Image by author\)](../images/003.png)
**Figure 3:** All operations inside the basic Block (Image by author)
Let's see what happens here:
  * The model looks back `3 days` = `72 hours` =`3 horizons` to predict the power usage of the next 24 hours.
  * The block receives the lookback window input.
  * The input then passes through a 4-layer neural network.
  * The result of this computation is directed to 2 outputs. Here, the dense layers **Dense 5** estimate the theta parameters (`θ^b` and `θ^f`), which are called **expansion coefficients**.
  * These parameters are then linearly projected into a new space using the **basis** layer transformations `g^b` and `g^f` to produce the _**backcast**_ and _**forecast**_ signals. This process is called "**neural basis expansion** ".


> So**,** how the backcast and forecast vectors are useful?
The **backcast** signal is the best-approximated vector that can optimally predict the **forecast** signal, given the `g^b` and `g^f` transformations. When `g^b` and `g^f` take specific forms, the backcast and forecast vectors become **interpretable** (more to that later).
### 2. The Stack
To increase the effectiveness of the _neural expansion process,_ the authors stack many blocks together. This structure is displayed in **Figure 4:**
![Figure 4: Stack of blocks \(left\) and stack of stacks \(right\) - \(Source\)](../images/004.png)
**Figure 4:** Stack of blocks (left) and stack of stacks (right) - ([Source](https://arxiv.org/pdf/1905.10437.pdf))
Only the first block receives the original sequence input. The downstream blocks receive the backcast signal `**x_l+1**`from the previous block (where`l` is the block index, i.e. `l_1` is the first block in the stack).
![Figure 5: Operations inside the block \(Image by author\)](../images/005.png)
**Figure 5:** Operations inside the block (Image by author)
Inside each stack, the backcast and forecast signals are organized into two branches: This topology is called **doubly residual stacking** and can be **** described by the following equations:
![](../images/body-fa9170d519e70125af49.png)
In each block, the model removes the part of the backcast signal **`x̂** _l`from the input **`x**_l` that has approximated well. In other words:
> The model at each block learns to optimally approximate a portion of the input signal, and sends the rest to be approximated by the downstream blocks.
Since each block models only a portion of the input signal, the final forecast is the sum of all _forecast_ `ŷ` signals from all blocks.
Finally, the stacks are also stacked (**Figure 4,** right). This architectural choice further increases the depth of the model and enhances its ability to learn complex time sequences.
We have seen how the generic version of _N-BEATS_ works. Next, we will describe the _interpretable_ version.
## Are N-BEATS and ARIMA related?
If you are familiar with **ARIMA** , you might have noticed a few similarities with the _N-BEATS_ approach _._
_ARIMA_ is modeled using the **Box-Jenkins** method, which is an iterative process. Specifically:
  1. First, we guess the orders of the **AR()** and **MA()** functions the (`p` and `q` parameters).
  2. Afterwards, we estimate the coefficients of these parameters using e.g. maximum likelihood estimation.
  3. Then, we verify if the model's conditions hold. For instance, the model's residual errors should be normal and independent. If not, we return to step 1 and repeat the process. This time, we add new `p` and `q` degrees on top of the previous ones.


In other words, in each step of Box-Jenkins, we add more information to our model. Each iteration creates a better representation of the input, based on the model residuals.
Hence, we can conclude that:
> In N-BEATS, each successive block models only the residual error due to the reconstruction of the backcast from the previous block and then updates the forecast based on that error. This process mimics the Box-Jenkins method when fitting ARIMA models.
The main difference between the 2 approaches is the target function of the residuals. _ARIMA_ focuses on the quality of the residuals, while _N-BEATS_ uses an arbitrary loss function.
Plus, we don't manually adjust any equation with _N-BEATS_ — the basis transformations are automatically optimized with backpropagation. With _ARIMA_ however, we make heavy use of autocorrelation and partial autocorrelation plots to guess the order of `AR()` and `MA()` functions.
> **Note:** Some ARIMA libraries implement the Box-Jenkins method with slight variations, depending on the programming language and the library. Here, we document the textbook implementation.
## N-BEATS - Interpretable Architecture
With a few changes, the _N-BEATS_ model can become interpretable: These are:
  * We use only 2 stacks, the **trend** and **seasonality** stacks. The generic architecture uses at least 30.
  * Both trend and seasonality stacks contain 3 blocks. In the generic architecture, we have one block per stack.
  * The **basis** layer weights of `g^b` and `g^f` are shared at the stack level.


The basic idea is that `g^b` and `g^f` basis take specific forms. Let's describe them in more detail.
### **The Trend Block**
Our goal is to restructure the `g^b` and `g^f` functions as monotonic that vary slowly across the forecast window.
Given a time vector t=[0,1,2,...,_H_ −2,_H_ −1] (`H` is the horizon), the thetas `θ` from the previous layer and the polynomial degree `p`, the trend model is defined as:
![](../images/body-0dd6214d7fa3c29ec78b.png)
In other words, we use the architecture of **Figure 3** (the generic block) and swap the last linear layer with the above operation. The result is shown in **Figure 6:**
![Figure 6: The Trend block \(Image by author\)](../images/006.png)
**Figure 6:** The Trend block (Image by author)
The backcast equations are not described in the paper, but they can easily be derived from the project's implementation. Moreover, the trend and seasonality blocks (**Figure 6** and **Figure 7**) adopt the parameters from the [official project repo](https://github.com/ServiceNow/N-BEATS/blob/master/experiments/electricity/interpretable.gin):
ini

```
interpretable.seasonality_layer_size = 2048
interpretable.seasonality_blocks = 3
interpretable.seasonality_layers = 4
interpretable.trend_layer_size = 256
interpretable.degree_of_polynomial = 3
interpretable.trend_blocks = 3
interpretable.trend_layers = 4
interpretable.num_of_harmonics = 1
```

### The Seasonality Block
Similarly, we swap the final layer with appropriate `g^b` and `g^f` functions that capture seasonality. An excellent candidate would be the Fourier series:
![](../images/body-01759f556ce3b14b11ba.png)
Then, the architecture becomes:
![Figure 7: The Seasonality block \(Image by author\)](../images/007.png)
**Figure 7:** The Seasonality block (Image by author)
Again, we stress that in all interpretable stacks, the `g^b` and `g^f` weights within the stack are shared.
## Experimental Results
Finally, the authors tested the performance of _N-BEATS_ in 3 popular time-series datasets - M3[6], M4[7], and Tourism[8].
### Experimental Setup
The authors categorized all models into specific classes and compared _N-BEATS_ with the best model of each class. For example, the _DL/TS hybrid_ is the winning ES-RNN model on M4.
Since all these datasets were used for data science competitions, all participants relied on ensembling to achieve maximum performance. Hence, the _N-BEATS_ authors relied on ensembling to be comparable. They used three variations: **N-BEATS-G** (generic)**, N-BEATS-I** (interpretable), **** an** d N-BEATS-I+**G (ensemble of all models from N-BEATS-G and N-BEATS-I).
On top of that, they created 6 different models with look back windows `2H, 3H .. 7H` for every horizon and variation. For extra details about the ensembling configurations,[ check the original paper](https://arxiv.org/pdf/1905.10437.pdf). In total, the authors ensembled 180 models to report the final results on the test set.
### Results
The results for all datasets are shown in **Figure 8:**
![Figure 8: Experimental results on M3, M4, and Tourism datasets \(Source\)](../images/008.png)
**Figure 8:** Experimental results on M3, M4, and Tourism datasets ([Source](https://arxiv.org/pdf/1905.10437.pdf))
The results are quite impressive.
The _N-BEATS_ outperforms the other implementations on all datasets, with _N-BEATS-I+G_ being the most successful.
Note that in every dataset, the competitions use the MAPE, sMAPE, and OWA metrics (lower is better). These metrics are popular in time-series competitions.
> **Note:** Contrary to the other approaches, N-BEATS does not require any hand-crafted feature engineering, or input scaling. Thus, N-BEATS is far more easier to use in different time-series tasks.
## Zero-shot transfer learning
The main contribution of _N-BEATS_ is its ability to successfully implement transfer learning on time series.
### Preliminaries
**Transfer learning** is a more general term— it refers to how a model can transfer its knowledge across different datasets. This is already established on Computer Vision or NLP tasks: We can download a pretrained model and adjust it to our dataset with fine-tuning.
**Meta-learning** (or few-shot-learning) is when the model can adapt to our dataset with little training/fine-tuning. The best scenario is _**zero-shot learning**_ , where the model is not trained on the target dataset.
> Zero-shot learning is the model's ability to make predictions using unseen data, without having specifically trained on them. This learning method better reflects the human perception.
Besides, this new paradigm shift towards meta-learning has been embraced by the latest AI research, such as OpenAI **—**[**CLIP [9]**](https://medium.com/towards-data-science/clip-the-most-influential-ai-model-from-openai-and-how-to-use-it-f8ee408958b1) and [**Whisper[10]**](https://medium.com/towards-data-science/whisper-transcribe-translate-audio-files-with-human-level-performance-df044499877) are a few of them.
### Zero-Shot N-BEATS
**Yoshua Bengio** (co-author of _N-BEATS_) has already established the theoretical foundation of transfer learning on forecasting tasks in his previous work [11].
The authors of _N-BEATS_ published a follow-up paper[12] where it summarizes most of this work, including what requirements a time-series forecasting model should meet to perform efficient transfer learning.
Let's focus on _N-BEATS._
The authors state that _N-BEATS's_ meta-learning ability hinges on two procedures: i) the **inner learning** procedure and the **outer learning** procedure. They are shown in **Figure 9:**
![Figure 9: Meta-learning procedures in N-BEATS \(Source, edited by author\)](../images/009.png)
**Figure 9:** Meta-learning procedures in N-BEATS ([Source](https://arxiv.org/pdf/1905.10437.pdf), edited by author)
**The inner loop** takes place inside each block and focuses on learning task-specific characteristics.
**The outer loop** takes place at the stack level. Here, the model learns global characteristics across all tasks.
> In other words, the inner loop learns local temporal traits, while the outer loop learns longer dependencies across all time-series.
However, this begs the following section:
### Why is ARIMA not suitable for Transfer Learning?
If an established paradigm dictates which criteria a forecasting model should meet to be appropriate for transfer learning, then why ARIMA is not?
To answer this question, we will again focus on the two learning procedures described by [12]
When creating an ARIMA model, there are 2 challenges:
  1. **Parameter estimation:** Parameters are estimated using a statistical technique like maximum likelihood. **This is the inner loop.**
  2. **Model formulation:** This defines the form of the autoregressive equation. For example, if our model has a little trend, no seasonality, and normal residuals, we can decide that a Gaussian ETS will probably do the job. **This is the outer loop.**


Notice that statistical models only pass the first criterion, the inner loop.
The parameter estimation part is straightforward once we have chosen our model. However, the model formulation part requires human intervention. Therefore, regarding the statistical approaches, **the role of the outer loop is not fulfilled.**
Thus, we conclude:
> N-BEATS replaces the predefined set of rules for model parameter estimation of classical statistical models with a learnable parameter estimation strategy. This strategy allows N-BEATS to generalize well on multiple, unseen time sequences.
### Zero-Shot learning results of N-BEATS
In this experimental analysis, the authors enrich the results of the previous benchmark (**Figure 8**) with some new models:
  * **N-BEATS-M4:** The authors create a pretrained _N-BEATS_ models on the M4.
  * **DeepAR-M4:** A pretrained _DeepAR_ model on the M4 is also added to the pool of models.


The total results are shown in **Figure 10** :
![Figure 10: Comparison of zero-shot models \(Source\)](../images/body-83692bbb491c2b7b5d50.png)
**Figure 10:** Comparison of zero-shot models ([Source)](https://arxiv.org/pdf/2002.02887.pdf)
Again, the results are very interesting.
  * Zero-shot _**N-BEATS-M4**_ outperforms all the other models on M4 and Tourism datasets (including the winners), even though it was not trained on them.
  * Zero-shot **DeepAR-M4** seems to perform poorly. This is expected since _DeepAR_ is not suitable for transfer learning.
  * In every dataset, the zero-shot _N-BEATS_ model performs very well compared to the tailored-trained _N-BEATS_. It would have been interesting to see an effective-robustness vs overall-robustness plot that is found in other zero-shot models such as Whisper.


## Closing Remarks
_N-BEATS_ is a breakthrough Deep Learning forecasting model that has left a lasting impact on the time-series field.
In this article, we described the two main strengths of _N-BEATS_ : First, it's a powerful model that produces SOTA results. Secondly, _N-BEATS_ establishes a well-defined framework for implementing zero-shot transfer learning. To the best of my knowledge, this is the first model to achieve this successfully.
In our next articles, we will present a programming tutorial with _N-BEATS,_ and describe a newer paper, called _N-HiTS_.
* * *
## Thank you for reading!
  * Follow me on [Linkedin](https://www.linkedin.com/in/nikos-kafritsas-b3699180/)!
  * Subscribe to my [newsletter](https://aihorizonforecast.substack.com/welcome), AI Horizon Forecast!


> [**AutoGluon-TimeSeries : Creating Powerful Ensemble Forecasts - Complete Tutorial**](https://aihorizonforecast.substack.com/p/autogluon-timeseries-creating-powerful)
## References
[1] Created from DALLE with the text prompt "a neon sinusoidal signal transmitting through space, concept art", to rg
[2] Slawek Smyl et al. [_M4 Forecasting Competition: Introducing a New Hybrid ES-RNN Model_](https://eng.uber.com/m4-forecasting-competition/)
[3] Boris O. et al. [_N-BEATS: Neural Basis Expansion Analysis For Interpretable Time Series Forecasting_](https://arxiv.org/pdf/1905.10437.pdf) _,_ ICLR (2020)
[4] D. Salinas et al. [_DeepAR: Probabilistic forecasting with autoregressive recurrent networks_](https://arxiv.org/pdf/1704.04110.pdf), International Journal of Forecasting (2019).
[5] [ElectricityLoadDiagrams20112014](https://archive.ics.uci.edu/ml/datasets/ElectricityLoadDiagrams20112014) dataset by UCI, CC BY 4.0.
[6] M3 Dataset <https://forecasters.org/resources/time-series-data/>, Public domain
[7] M4 Dataset <https://forecasters.org/resources/time-series-data/>, Public domain
[8] Tourism Dataset <https://www.kaggle.com/c/tourism1>, Public domain
[9] Alec Radford et al. [_Learning Transferable Visual Models From Natural Language Supervision_](https://arxiv.org/pdf/2103.00020.pdf) _(Feb 2021)_
[10] Alec Radford et al. [Robust Speech Recognition via Large-Scale Weak Supervision](https://cdn.openai.com/papers/whisper.pdf) _(September 2022)_
[11] Yoshua Bengio et al. _Learning a synaptic learning rule_
[12] Boris O. et al. [_Meta-learning framework with applications to zero-shot time-series forecasting_](https://arxiv.org/pdf/2002.02887.pdf)
## Register Now to Continue Reading
### Unlock Towards Data Science with a Free Account
All articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.
Register for freeSign in to your account
* * *
![](../images/body-80a660d4ad923cabc0d5.jpeg)
Written By
## [Nikos Kafritsas](https://towardsdatascience.com/author/nikoskafritsas/)
[See all from Nikos Kafritsas](https://towardsdatascience.com/author/nikoskafritsas/)
[Artificial Intelligence](https://towardsdatascience.com/tag/artificial-intelligence/)[Data Science](https://towardsdatascience.com/tag/data-science/)[Deep Learning](https://towardsdatascience.com/tag/deep-learning/)[Science](https://towardsdatascience.com/tag/science/)[Time Series Forecasting](https://towardsdatascience.com/tag/time-series-forecasting/)
Share This Article
  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fn-beats-time-series-forecasting-with-neural-basis-expansion-af09ea39f538%2F&title=N-BEATS%C2%A0%3A%20Time-Series%20Forecasting%20with%20Neural%20Basis%20Expansion)
  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fn-beats-time-series-forecasting-with-neural-basis-expansion-af09ea39f538%2F&title=N-BEATS%C2%A0%3A%20Time-Series%20Forecasting%20with%20Neural%20Basis%20Expansion)
  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fn-beats-time-series-forecasting-with-neural-basis-expansion-af09ea39f538%2F&text=N-BEATS%C2%A0%3A%20Time-Series%20Forecasting%20with%20Neural%20Basis%20Expansion)


Towards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.
[Write for TDS](https://towardsdatascience.com/submissions/)
## Related Articles
  * [![](../images/010.jpeg)](https://towardsdatascience.com/my-challenges-in-building-an-nlp-based-product-as-a-high-school-student-f0b8f2e85edc/)
## [My challenges in building an NLP-based product as a high school student](https://towardsdatascience.com/my-challenges-in-building-an-nlp-based-product-as-a-high-school-student-f0b8f2e85edc/)
[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)
And how I managed to solve them without spending a dime of my non-existent savings
[Vagif Aliyev](https://towardsdatascience.com/author/vagifaliyev/)
August 16, 20217 min read
  * [![](../images/011.jpeg)](https://towardsdatascience.com/ai-feynman-2-0-learning-regression-equations-from-data-3232151bd929/)
## [AI Feynman 2.0: Learning Regression Equations From Data](https://towardsdatascience.com/ai-feynman-2-0-learning-regression-equations-from-data-3232151bd929/)
[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)
Let's kick the tires on a brand new library
[Daniel Shapiro, PhD](https://towardsdatascience.com/author/lemaysolutions/)
July 1, 20209 min read
  * [![](../images/012.jpg)](https://towardsdatascience.com/handling-missing-data-like-a-pro-part-1-deletion-methods-9f451b475429/)
## [Handling "Missing Data" Like a Pro - Part 1 - Deletion Methods](https://towardsdatascience.com/handling-missing-data-like-a-pro-part-1-deletion-methods-9f451b475429/)
[Data Science](https://towardsdatascience.com/category/data-science/)
Basic and Advanced Techniques for the 21st Century Data Scientist
[TheDataProf](https://towardsdatascience.com/author/francisadrianviernes/)
July 7, 20216 min read
  * [![](../images/013.jpg)](https://towardsdatascience.com/feature-selection-for-machine-learning-in-python-filter-methods-6071c5d267d5/)
## [Feature Selection for Machine Learning in Python - Filter Methods](https://towardsdatascience.com/feature-selection-for-machine-learning-in-python-filter-methods-6071c5d267d5/)
[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)
How to select the right predictors using statistical measures
[Jack Tan](https://towardsdatascience.com/author/jackyeetan/)
September 13, 20200 min read
  * [![](../images/014.jpg)](https://towardsdatascience.com/4-nlp-libraries-for-automatic-language-identification-of-text-data-in-python-cbc6bf664774/)
## [4 NLP Libraries for Automatic Language Identification of Text Data In Python](https://towardsdatascience.com/4-nlp-libraries-for-automatic-language-identification-of-text-data-in-python-cbc6bf664774/)
[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)
Comprehensive overview of open-source libraries for automatic language detection
[Zoumana Keita](https://towardsdatascience.com/author/zoumanakeita/)
February 21, 20222 min read
  * [![](../images/015.jpg)](https://towardsdatascience.com/is-ai-there-yet-ef57cd306555/)
## [Is AI there yet?](https://towardsdatascience.com/is-ai-there-yet-ef57cd306555/)
[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)
A quick summary through the problems faced by AI today!
[Alexiei Dingli](https://towardsdatascience.com/author/alexieidingli/)
April 1, 202114 min read
  * [![](../images/016.jpeg)](https://towardsdatascience.com/pump-it-up-with-catboost-828bf9eaac68/)
## [Pump it Up with CatBoost](https://towardsdatascience.com/pump-it-up-with-catboost-828bf9eaac68/)
[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)
Data Mining and a Simple Starter Model
[Taras Baranyuk](https://towardsdatascience.com/author/taras-baranyuk/)
February 15, 20219 min read
  * [![](../images/017.jpeg)](https://towardsdatascience.com/the-application-of-an-artificial-neuron-on-the-iris-dataset-in-python-9fb4275fadd/)
## [The application of an Artificial Neuron on the Iris Dataset in Python](https://towardsdatascience.com/the-application-of-an-artificial-neuron-on-the-iris-dataset-in-python-9fb4275fadd/)
[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)
Predicting flowers' variety with a single layer neural network without a deep learning library
[Giovanni Valdata](https://towardsdatascience.com/author/giovanni-valdata/)
April 5, 202210 min read
  * [![](../images/018.jpg)](https://towardsdatascience.com/debugging-in-python-is-easy-with-with-assert-statements-ff333bfb3388/)
## [Debugging in Python Is Easy With Assert Statements](https://towardsdatascience.com/debugging-in-python-is-easy-with-with-assert-statements-ff333bfb3388/)
[Programming](https://towardsdatascience.com/category/programming/)
A look into a tool that allows a pain-free troubleshooting experience
[Aashish Nair](https://towardsdatascience.com/author/aashishnair/)
September 20, 20224 min read


  * [YouTube](https://www.youtube.com/c/TowardsDataScience)
  * [X](https://x.com/TDataScience)
  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)
  * [Threads](https://www.threads.net/@towardsdatascience)
  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)


[](https://towardsdatascience.com/)
Your home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.
Subscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)
© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)
####  Recommended Articles 
Close
  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ "Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1")
  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ "The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs")
  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ "Does Your Company Have a Data Strategy?")
  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/4970/image?etag=1780565225463&width=500&height=500) Productivity Tips, Data Career Insights, and Other Recent Must-Reads ](https://towardsdatascience.com/productivity-tips-data-career-insights-and-other-recent-must-reads-5c47eb7a2fe0/ "Productivity Tips, Data Career Insights, and Other Recent Must-Reads")


