Skip to main content

Deep Generative Transformers for Probabilistic Time Series and Spatiotemporal Forecasting

Project description

Enformer Logo

🚀 Genformer: Deep Generative Transformers

For Probabilistic Time Series and Spatiotemporal Forecasting 📈✨

PyPI Python PyTorch Docs License


🌟 Introduction

Welcome to Genformer! 🎉 This is the official Python package for the paper:

"Deep Generative Transformers for Probabilistic Time Series and Spatiotemporal Forecasting" 📝

Time series forecasting is hard, especially when dealing with uncertainty. Genformer brings the power of Transformers 🤖 together with the Engression Paradigm 🎲 (distributional regression) to give you:

  • Robust multivariate trajectories instead of boring point predictions!
  • Extremely lightweight probabilistic capabilities with constant-factor overhead.
  • 🌍 Spatiotemporal support via Graph-Enformer (GEnformer) for when your data has geographical/spatial relationships.

🛠️ Installation

Get up and running in seconds! 🏃‍♂️💨

pip install genformer

Or install the latest development version from source:

git clone https://github.com/yuvrajiro/Genformer.git
cd Enformer
pip install -e .

💡 Quick Start

Generating probabilistic forecasts is as easy as pie 🥧:

import pandas as pd
from darts import TimeSeries
from genformer.models import Enformer

# 1. Load your TimeSeries data 📊
series = TimeSeries.from_dataframe(pd.read_csv("your_data.csv"))

# 2. Initialize the awesome Enformer! 🚀
model = Enformer(
    input_chunk_length=24,
    output_chunk_length=12,
    num_samples_engression=10, # Number of ensemble samples
    n_epochs=30
)

# 3. Train & Predict 🔥
model.fit(series)
prediction = model.predict(n=12, num_samples=50)

# 4. Plot a beautiful probabilistic forecast 🌈
prediction.plot(low_quantile=0.05, high_quantile=0.95)

🏗️ Architecture

🔮 Enformer (Temporal)

Injects pre-additive stochastic noise $\epsilon \sim \mathcal{N}(0, \sigma^2 \mathbf{I})$ into the batch-expanded inputs, optimizing the strictly proper Energy Score Loss.

🌐 Graph-Enformer (Spatiotemporal)

Extends Enformer by passing the spatial inputs through a Graph Convolutional Network (GCN) to capture intricate geographical topologies before processing temporal dependencies! 📍🗺️


📚 Documentation & Examples

📖 Read the full documentation online: yuvrajiro.github.io/Genformer

Extensive documentation is built using Sphinx and pydata-sphinx-theme! To build the docs locally:

cd docs
make html
# Then open _build/html/index.html in your browser! 🌐

Check out the docs/examples/ directory for fully runnable Jupyter Notebooks demonstrating both temporal and spatiotemporal forecasting! 🚀


📜 Citation & Special Thanks

If you find this work useful in your research, please cite our paper:

@article{pathak2026deep,
  title={Deep Generative Transformers for Probabilistic Time Series and Spatiotemporal Forecasting},
  author={Pathak, Rajdeep and Goswami, Rahul and Panja, Madhurima and Ghosh, Palash and Chakraborty, Tanujit},
  journal={arXiv preprint arXiv:260307108},
  year={2026}
}

💖 Special Thanks: We would like to extend a very special thanks to Donia Besher for her invaluable contributions and support! 🙌


Made with ❤️ by the Genformer Team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

genformer-0.1.1.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

genformer-0.1.1-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file genformer-0.1.1.tar.gz.

File metadata

  • Download URL: genformer-0.1.1.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for genformer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 307d2da651521b0a840ca0b22322f862f6c0a3c4187a28b4a130aa0022ba020c
MD5 c5b9822e6524f30e67b288875e3a5f1b
BLAKE2b-256 24247e4b66eaad71e4ec74c16e170f61fda1cf0dc9613bd5566f57dc3c2ba553

See more details on using hashes here.

File details

Details for the file genformer-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: genformer-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for genformer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 649557122270c84b6688168ae138a5cb6f2c112825a82be062fb87a21696b4ea
MD5 6585140462d67668ee1a92d7b032b75a
BLAKE2b-256 84cdd1952739baf203dcb7805b9f40094f3fab0e314343a5152280310435c98d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page