Skip to content
GluonTS - Probabilistic Time Series Modeling in Python
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.devtools/githooks remove flake8 from githook (#109) Jun 14, 2019
.github github templates (#135) Jun 20, 2019
ci Disable warnings-as-failure for doc builds on master (#72) Jun 17, 2019
docs Serialization example, plus fixes to paths (#143) Jun 21, 2019
env Website and CI (#10) May 30, 2019
evaluations small table formatting and script fix (#84) Jun 7, 2019
examples Serialization example, plus fixes to paths (#143) Jun 21, 2019
src/gluonts include safety check that catches infinite loops in transformations (#… Jun 21, 2019
test Add support for feat_dynamic_real in DeepAREstimator (#125) Jun 20, 2019
.gitignore Revert "ignoring (#138)" (#140) Jun 21, 2019
.pylintrc Website and CI (#10) May 30, 2019
.travis.yml Updated travis password. (#102) Jun 13, 2019 Initial code commit May 17, 2019 remove flake8 from githook (#109) Jun 14, 2019
LICENSE Initial code commit May 17, 2019 Added ``. (#145) Jun 24, 2019
Makefile Add --no-dir-entries to zip file creation to prune empty directories (#… Jun 5, 2019
NOTICE Add Apache 2.0 license file headers and update NOTICE (#48) Jun 3, 2019 add bibtex entry to readme (#119) Jun 18, 2019
codecov.yml Website and CI (#10) May 30, 2019 Website and CI (#10) May 30, 2019
contributor.rst Update contributors.rst (#47) Jun 3, 2019 remove flake8 from githook (#109) Jun 14, 2019
pyproject.toml Updated black to version 19. (#118) Jun 17, 2019
pytest.ini Website and CI (#10) May 30, 2019
requirements-docs.txt Move docs requirements to a dedicated file (#142) Jun 21, 2019
requirements-extras-prophet.txt Add extra requirements for R forecast and Prophet (#27) May 29, 2019
requirements-extras-r.txt Fix rpy2 version requirement (#89) Jun 7, 2019
requirements-setup.txt Move docs requirements to a dedicated file (#142) Jun 21, 2019
requirements-test.txt Update requirements files (#55) Jun 4, 2019
requirements.txt Updating pydantic to `0.28`. (#108) Jun 14, 2019
setup.cfg Update setup.cfg (#4) Jun 13, 2019 Move docs requirements to a dedicated file (#142) Jun 21, 2019

GluonTS - Probabilistic Time Series Modeling in Python

GluonTS is a Python toolkit for probabilistic time series modeling, built around Apache MXNet (incubating).

GluonTS provides utilities for loading and iterating over time series datasets, state of the art models ready to be trained, and building blocks to define your own models and quickly experiment with different solutions.


GluonTS requires Python 3.6, and the easiest way to install it is via pip:

pip install gluonts

Quick start guide

This simple example illustrates how to train a model from GluonTS on some data, and then use it to make predictions. As a first step, we need to collect some data: in this example we will use the volume of tweets mentioning the AMZN ticker symbol.

import pandas as pd
url = ""
df = pd.read_csv(url, header=0, index_col=0)

The first 100 data points look like follows:

import matplotlib.pyplot as plt


We can now prepare a training dataset for our model to train on. Datasets in GluonTS are essentially iterable collections of dictionaries: each dictionary represents a time series with possibly associated features. For this example, we only have one entry, specified by the "start" field which is the timestamp of the first datapoint, and the "target" field containing time series data. For training, we will use data up to midnight on April 5th, 2015.

from gluonts.dataset.common import ListDataset
training_data = ListDataset(
    [{"start": df.index[0], "target": df.value[:"2015-04-05 00:00:00"]}],
    freq = "5min"

A forecasting model in GluonTS is a predictor object. One way of obtaining predictors is by training a correspondent estimator. Instantiating an estimator requires specifying the frequency of the time series that it will handle, as well as the number of time steps to predict. In our example we're using 5 minutes data, so freq="5min", and we will train a model to predict the next hour, so prediction_length=12. We also specify some minimal training options.

from gluonts.model.deepar import DeepAREstimator
from gluonts.trainer import Trainer

estimator = DeepAREstimator(freq="5min", prediction_length=12, trainer=Trainer(epochs=10))
predictor = estimator.train(training_data=training_data)

During training, useful information about the progress will be displayed. To get a full overview of the available options, please refer to the documentation of DeepAREstimator (or other estimators) and Trainer.

We're now ready to make predictions: we will forecast the hour following the midnight on April 15th, 2015.

test_data = ListDataset(
    [{"start": df.index[0], "target": df.value[:"2015-04-15 00:00:00"]}],
    freq = "5min"

from gluonts.dataset.util import to_pandas

for test_entry, forecast in zip(test_data, predictor.predict(test_data)):
    forecast.plot(color='g', prediction_intervals=[50.0, 90.0])


Note that the forecast is displayed in terms of a probability distribution: the shaded areas represent the 50% and 90% prediction intervals, respectively, centered around the median (dark green line).

Further examples

The following are good entry-points to understand how to use many features of GluonTS:

The following modules illustrate how custom models can be implemented:


If you wish to contribute to the project, please refer to our contribution guidelines.


If you use GluonTS in a scientific publication, we encourage you to add the following reference to the associated paper:

  title={{GluonTS: Probabilistic Time Series Modeling in Python}},
  author={Alexandrov, A. and Benidis, K. and Bohlke-Schneider, M. and
          Flunkert, V. and Gasthaus, J. and Januschowski, T. and Maddix, D. C.
          and Rangapuram, S. and Salinas, D. and Schulz, J. and Stella, L. and
          Türkmen, A. C. and Wang, Y.},
  journal={arXiv preprint arXiv:1906.05264},
You can’t perform that action at this time.