Need help with TimeGAN?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

150 Stars 53 Forks 6 Commits 0 Opened issues


Codebase for Time-series Generative Adversarial Networks (TimeGAN) - NeurIPS 2019

Services available


Need anything else?

Contributors list

# 227,966
6 commits

Codebase for "Time-series Generative Adversarial Networks (TimeGAN)"

Authors: Jinsung Yoon, Daniel Jarrett, Mihaela van der Schaar

Reference: Jinsung Yoon, Daniel Jarrett, Mihaela van der Schaar, "Time-series Generative Adversarial Networks," Neural Information Processing Systems (NeurIPS), 2019.

Paper Link:

Contact: [email protected]

This directory contains implementations of TimeGAN framework for synthetic time-series data generation using one synthetic dataset and two real-world datasets.

  • Sine data: Synthetic
  • Stock data:
  • Energy data:

To run the pipeline for training and evaluation on TimeGAN framwork, simply run python3 -m or see jupyter-notebook tutorial of TimeGAN in tutorialtimegan.ipynb.

Note that any model architecture can be used as the generator and discriminator model such as RNNs or Transformers.

Code explanation

(1) - Transform raw time-series data to preprocessed time-series data (Googld data) - Generate Sine data

(2) Metrics directory (a) - PCA and t-SNE analysis between Original data and Synthetic data (b) - Use Post-hoc RNN to classify Original data and Synthetic data (c) - Use Post-hoc RNN to predict one-step ahead (last feature)

(3) - Use original time-series data as training set to generater synthetic time-series data

(4) - Report discriminative and predictive scores for the dataset and t-SNE and PCA analysis

(5) - Some utility functions for metrics and timeGAN.

Command inputs:

  • data_name: sine, stock, or energy
  • seq_len: sequence length
  • module: gru, lstm, or lstmLN
  • hidden_dim: hidden dimensions
  • num_layers: number of layers
  • iterations: number of training iterations
  • batch_size: the number of samples in each batch
  • metric_iterations: number of iterations for metric computation

Note that network parameters should be optimized for different datasets.

Example command

$ python3 --data_name stock --seq_len 24 --module gru
--hidden_dim 24 --num_layer 3 --iteration 50000 --batch_size 128 
--metric_iteration 10


  • ori_data: original data
  • generated_data: generated synthetic data
  • metric_results: discriminative and predictive scores
  • visualization: PCA and tSNE analysis

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.