Skip to main content
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

Metadata

Release files for genformer 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for genformer 0.1.2
File Size Uploaded
genformer-0.1.2.tar.gz 18.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for genformer 0.1.2
File Interpreter ABI Platform
genformer-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 37.2 kB

Release files / genformer-0.1.2.tar.gz

Download URL genformer-0.1.2.tar.gz
Size 18.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6db14a19581d75a60156f9e877954dbe44e5aeef253546e88bca063571cd460a
BLAKE2b-256 checksum
How to use checksums
f8c12f3cbd0dbf1f659ee7a4ea71461b45a515bc8bcdd5eea39c907ce1ad5480
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / genformer-0.1.2-py3-none-any.whl

Download URL genformer-0.1.2-py3-none-any.whl
Size 18.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0dcdf2717465cf6dccb983cb8083f44a047dc15af941992af189287fea7c885
BLAKE2b-256 checksum
How to use checksums
db6e1f31f6286dd4d4be42f1f3b3f459078328a35f999e913e850667f9e4b5c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page