Favicon of PyTorch Forecasting

PyTorch Forecasting

An open-source Python library for neural time series forecasting, with interpretable models and training on CPUs or GPUs under the MIT license.

Screenshot of PyTorch Forecasting website

PyTorch Forecasting is a Python library for developers and researchers who want to predict time series with neural networks on their own hardware. It combines ready-made forecasting architectures with data preparation, training, and evaluation tools. It's open source under the MIT license.

The library handles much of the work between a pandas DataFrame and a trained model: variable transformations, missing values, and sequences with different amounts of history. Its high-level API provides defaults for beginners while allowing experienced users to build custom models and components.

Available models include Temporal Fusion Transformers for interpretable forecasts across multiple future steps, DeepAR for probabilistic forecasting, and N-HiTS for long forecast horizons with additional input variables. N-BEATS and PatchTST provide other approaches, while LSTM, GRU, and a model that repeats the last known value give users baselines for comparison.

Interpretation is part of the package. Built-in model interpretation tools, plots comparing predictions with actual values, and dependency plots help users examine model behavior. Metrics evaluate forecasts across multiple future steps, and Optuna supports hyperparameter tuning.

PyTorch Lightning provides training on CPUs, a single GPU, or multiple GPUs. The training framework also supports automatic logging, including TensorBoard.

Similar to PyTorch Forecasting