Training a DeepAR model with GluonTS
DeepAR is a state-of-the-art forecasting method that utilizes autoregressive recurrent networks to predict future values of time series data. Amazon introduced it; it was designed for forecasting tasks that can benefit from longer horizons, such as demand forecasting. The method is particularly powerful when there’s a need to generate forecasts for multiple related time series.
Getting ready
We’ll use the same dataset as in the previous recipe:
from gluonts.dataset.repository.datasets import get_dataset dataset = get_dataset("nn5_daily_without_missing", regenerate=False)
Now, let’s see how to build a DeepAR model with this data.
How to do it…
We start by formatting the data for training:
- Let’s do this by using the
ListDataset
data structure:from gluonts.dataset.common import ListDataset from gluonts.dataset.common import FieldName train_ds = ListDataset( ...