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: genformer.readthedocs.io

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.2.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.2-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: genformer-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 6db14a19581d75a60156f9e877954dbe44e5aeef253546e88bca063571cd460a
MD5 31e4375f64d2dc32d0a9cfbdac287ec0
BLAKE2b-256 f8c12f3cbd0dbf1f659ee7a4ea71461b45a515bc8bcdd5eea39c907ce1ad5480

See more details on using hashes here.

File details

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

File metadata

  • Download URL: genformer-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a0dcdf2717465cf6dccb983cb8083f44a047dc15af941992af189287fea7c885
MD5 3c87d4e57745589d19680be1b46f51cc
BLAKE2b-256 db6e1f31f6286dd4d4be42f1f3b3f459078328a35f999e913e850667f9e4b5c4

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