Skip to content

hkuedl/GenTS

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

124 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GenTS: A Comprehensive Benchmark Library for Generative Time Series Models

GenTS is an open-source library for researchers to conduct generative time series analysis, which covers (class label-guided) synthesis, forecasting and imputation.

📰 News

  • 2025-04-09: Added computational overhead analysis comparing memory and runtime across representative models.
  • 2025-04-09: Added Super-resolution support for Vanilla models with a tutorial.
  • 2025-04-08: Added GenTS acceleration tutorial based on lightning.
  • 2025-04-06: Added selectable Predictive Score and Discriminative Score backbones (now we have GRU, CNN, Transformer).

✨ Highlights

Based on lightning, GenTS provides a modular code base to benchmark different models on various datasets in a easy way. Specifically, we feature on:

  • State-of-the-art Models: Generative time series models from top conferences in 5 recent years, including Diffusions, Flows, GANs, etc.
  • Multi-domain Datasets: Various time series datasets from energy, health, and other domains.
  • Comprehensive Evaluation: Both quantitative and qualitative methods for fidelity, usefulness, and accuracy.

📖 Documents

For detailed tutorial of our library and API information, please refer to the our documents.

⚙️ Installation

We recommand to first create a virtual environment, and activate the environment. Then you can install the necessary libraries by running the following command.

conda create -n gents python=3.10
conda activate gents
pip install -r requirements.txt
pip install -e .

🚖 Quick start

A minimal example of (unconditional) time series generation:

import torch
from gents.model import VanillaDDPM
from gents.dataset import SineND
from gents.evaluation import tsne_visual
from lightning import Trainer

# setup dataset and model
dm = SineND(seq_len=64, seq_dim=2, batch_size=64)
model = VanillaDDPM(seq_len=dm.seq_len, seq_dim=dm.seq_dim)

# training (on CPU for example)
trainer = Trainer(max_epochs=100, accelerator="cpu")
trainer.fit(model, dm)

# testing
dm.setup("test")
real_data = torch.cat([batch["seq"] for batch in dm.test_dataloader()])  # [N, 64, 2]
gen_data = model.sample(n_sample=len(real_data))  # [N, 64, 2]

# visualization with tsne
tsne_visual(real_data, gen_data, save_root="tsne.png")

We also provide tutorials for different use case of generative time series models, including common conditional generation tasks (forecasting, imputation, class label-guided synthesis) and others. Please refer to tutorials/ or our documents for detailed examples.

The scripts for running benchmark experiments are located in the test/ folder, incluing training and sampling for (class label-guided) synthesis, imputation, and forecasting. Please feel free to start with our scripts.

🏰 Model zoo

GenTS included 25+ state-of-the-art generative time series models (and their variants), with different capabilities. Our model zoo will be updated in a regular basis.

🤖 Name 🗂️ Model Type Synthesis Forecasting Imputation Class label
VanillaVAE VAE
TimeVAE VAE
TimeVQVAE VAE
KoVAE VAE
VanillaGAN GAN
TimeGAN GAN
GT-GAN GAN
PSA-GAN GAN
RCGAN GAN
VanillaMAF Flow
Fourier Flow Flow
VanillaDDPM Diffusion
CSDI Diffusion
Diffusion-TS Diffusion
TMDM Diffusion
FourierDiffusion Diffusion
ImagenTime Diffusion
FIDE Diffusion
Latent ODE Diff. Eq.
Latent SDE Diff. Eq.
SDEGAN Diff. Eq.
LS4 Diff. Eq.

📝 Datasets

GenTS preset over 10 widely used time series generation datasets, from multiple domains and resoulutions. Some of them come naturally with missing values and class labels, supporting to benchmark different kinds of models.

🤖Name 🧭 Resolution 📦 Dimension ⭕️ Missing value 🏷️ Class label 📪 Domain
SineND continuous N - - Physics
Spiral2D continuous 2 - 2 Physics
Stocks 1 day 6 - - Financial
Energy 10 min 28 - - Energy
ETT 1 hour/15 min 7 - - Energy
Electricity 1 hour 321 - - Energy
Traffic 1 hour 862 - - Traffic
Exchange 1 day 8 - - Financial
MoJoCo continuous 14 - - Physics
Physionet 1 min - 1 hour 35 2 Healthcare
ECG ~700 Hz 1 - 5 Healthcare
Air quality 1 hour 6 - Environment
Weather 10 min 6 - - Environment

GenTS supports arbitrary seq_len and seq_dim settings for datasets and models. The computational overheads of space and time could vary depending on specific model designs. On single NVIDIA GeForce RTX 3080 Ti, we measured the training/inference GPU memory/time overheads of representative models (batch_size=32 and inference_batch_size=16) with different seq_len and seq_dim combination. The full results shown below:

hh

It reveals space-time trade-offs in high-dimensional cases. COSCIGAN hits severe memory limits (OOM) in large seq_dim but infers fast. VanillaMAF trains fastest yet suffers catastrophic inference latency. Conversely, DiffusionTS occupies memory by seq_len, and TimeVQVAE offer the most balanced scaling capabilities.

🔧 Custormization

Our BaseModel and datamodules BaseData are based on lightning,

One can easily join GenTS following the lightning.LightningModule and lightning.DataModule. Please refer to our document's tutorial on custormization for details, or this website.

🙏 All Thanks To Our Contributors

📎 Citation

If you enjoy or benefit from using GenTS, a citation to this repository will be greatly appreciated!

@misc{wang2025a,
title={GenTS: A Comprehensive Benchmark Library for Generative Time Series Models},
author={Chenxi Wang, Xiaorong Wang, Peiyang Li, Yi Wang},
year={2025},
url={https://github.com/WillWang1113/GenTS}
}

About

A library for generative time series analysis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 56.3%
  • Jupyter Notebook 43.7%