Interpretable forecasting with N-BEATS
This recipe introduces Neural Basis Expansion Analysis for Interpretable Time Series Forecasting (N-BEATS), a deep learning method for forecasting problems. We’ll show you how to train N-BEATS using PyTorch Forecasting and interpret its output.
Getting ready
N-BEATS is particularly designed for problems involving several univariate time series. So, we’ll use the dataset introduced in the previous chapter (check, for example, the Preparing multiple time series for a global model recipe):
import numpy as np import pandas as pd from gluonts.dataset.repository.datasets import get_dataset from pytorch_forecasting import TimeSeriesDataSet import lightning.pytorch as pl from sklearn.model_selection import train_test_split dataset = get_dataset('nn5_daily_without_missing', regenerate=False) N_LAGS = 7 HORIZON = 7 datamodule = GlobalDataModule(data=dataset, n_lags=N_LAGS, ...