PyTorch Forecasting Documentation#


Our article on Towards Data Science introduces the package and provides background information.

PyTorch Forecasting aims to ease state-of-the-art timeseries forecasting with neural networks for both real-world cases and research alike. The goal is to provide a high-level API with maximum flexibility for professionals and reasonable defaults for beginners. Specifically, the package provides

  • A timeseries dataset class which abstracts handling variable transformations, missing values, randomized subsampling, multiple history lengths, etc.

  • A base model class which provides basic training of timeseries models along with logging in tensorboard and generic visualizations such actual vs predictions and dependency plots

  • Multiple neural network architectures for timeseries forecasting that have been enhanced for real-world deployment and come with in-built interpretation capabilities

  • Multi-horizon timeseries metrics

  • Ranger optimizer for faster model training

  • Hyperparameter tuning with optuna

The package is built on PyTorch Lightning to allow training on CPUs, single and multiple GPUs out-of-the-box.

If you do not have pytorch already installed, follow the detailed installation instructions.

Otherwise, proceed to install the package by executing

pip install pytorch-forecasting

or to install via conda

conda install pytorch-forecasting pytorch>=1.7 -c pytorch -c conda-forge

To use the MQF2 loss (multivariate quantile loss), also execute

pip install pytorch-forecasting[mqf2]

Vist Getting started to learn more about the package and detailled installation instruction. The Tutorials section provides guidance on how to use models and implement new ones.

Indices and tables#