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.0.tar.gz (18.8 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.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: genformer-0.1.0.tar.gz
  • Upload date:
  • Size: 18.8 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.0.tar.gz
Algorithm Hash digest
SHA256 30a2608f587e32956cecefba190c0bc373de8c8e4a78671a2ebb373a3aa704c4
MD5 de590d570a9c1394f2ede85af6459cf3
BLAKE2b-256 f91f23c7a8d5c646b9795897f834a4dff145d61498fe9430908d62cf66e02139

See more details on using hashes here.

File details

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

File metadata

  • Download URL: genformer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1ed17b2a403fc1ad2751c44a57273982c1daf46611bb58f8654544c5f891485
MD5 0c32ea8f2aad5d6b10fdf649f5006f0b
BLAKE2b-256 994f2a548b318bbf091be24a2e32b45dcd6b0c1ad97147dd661c59a0caa25fdf

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