Basic usage of GluonTS for probabilistic, deep learning-based time series forecasting

Danny Morris



GluonTS is a deep learning-based framework for probabilisitc time series modeling and forecasting. As mentioned in the paper, deep learning models improve upon traditional univariate models (e.g. Arima) with their ability to train a single, global model over an entire collection of time series.


The use case shown in this notebook involves jointly training and forecasting 152 time series at monthly intervals. The data are originally in CSV format. The DeepAR estimator is applied to the training data, and code for a faster feedforward MLP alternative is provided for reference at the end.


The following pseudocode represents the general workflow in the Jupyter notebook.

READ raw data
TRANSFORM raw data to wide format where each column is a time series
PARTITION training and testing data
TRANSFORM training and testing data to ListDataset format for GluonTS compatibility
SET GluonTS estimator (e.g. DeepAR)
TRAIN estimator jointly over all time series in training data
PREDICT values jointly for all time series in testing data
PRINT prediction accuracy metrics for each time series
PLOT predictions

Takeaways from my experience getting started