An Open Source Project from the Data to AI Lab, at MIT
- Website: https://sdv.dev
- Documentation: https://sdv.dev/SDV
- Repository: https://github.com/sdv-dev/CTGAN
- License: MIT
- Development Status: Pre-Alpha
CTGAN is a collection of Deep Learning based Synthetic Data Generators for single table data, which are able to learn from real data and generate synthetic clones with high fidelity.
Currently, this library implements the CTGAN and TVAE models proposed in the Modeling Tabular data using Conditional GAN paper. For more information about these models, please check out the respective user guides:
CTGAN has been developed and tested on Python 3.6, 3.7 and 3.8
The recommended way to installing CTGAN is using pip:
pip install ctgan
This will pull and install the latest stable release from PyPI.
CTGAN can also be installed using conda:
conda install -c sdv-dev -c pytorch -c conda-forge ctgan
This will pull and install the latest stable release from Anaconda.
⚠️ WARNING: If you're just getting started with synthetic data, we recommend using the SDV library which provides user-friendly APIs for interacting with CTGAN. To learn more about using CTGAN through SDV, check out the user guide here.
To get started with CTGAN, you should prepare your data as either a numpy.ndarray
or a pandas.DataFrame
object with two types of columns:
- Continuous Columns: can contain any numerical value.
- Discrete Columns: contain a finite number values, whether these are string values or not.
In this example we load the Adult Census Dataset which is a built-in demo dataset. We then model it using the CTGANSynthesizer and generate a synthetic copy of it.
from ctgan import CTGANSynthesizer
from ctgan import load_demo
data = load_demo()
# Names of the columns that are discrete
discrete_columns = [
'workclass',
'education',
'marital-status',
'occupation',
'relationship',
'race',
'sex',
'native-country',
'income'
]
ctgan = CTGANSynthesizer(epochs=10)
ctgan.fit(data, discrete_columns)
# Synthetic copy
samples = ctgan.sample(1000)
- Please have a look at the Contributing Guide to see how you can contribute to the project.
- If you have any doubts, feature requests or detect an error, please open an issue on github or join our Slack Workspace.
- Also, do not forget to check the project documentation site!
If you use CTGAN, please cite the following work:
- Lei Xu, Maria Skoularidou, Alfredo Cuesta-Infante, Kalyan Veeramachaneni. Modeling Tabular data using Conditional GAN. NeurIPS, 2019.
@inproceedings{xu2019modeling,
title={Modeling Tabular data using Conditional GAN},
author={Xu, Lei and Skoularidou, Maria and Cuesta-Infante, Alfredo and Veeramachaneni, Kalyan},
booktitle={Advances in Neural Information Processing Systems},
year={2019}
}
Please note that these libraries are external contributions and are not maintained nor supervised by the MIT DAI-Lab team.
A wrapper around CTGAN has been implemented by Kevin Kuo @kevinykuo, bringing the functionalities of CTGAN to R users.
More details can be found in the corresponding repository: https://github.com/kasaai/ctgan
A package to easily deploy CTGAN onto a remote server. This package is developed by Timothy Pillow @oregonpillow.
More details can be found in the corresponding repository: https://github.com/oregonpillow/ctgan-server-cli
This repository is part of The Synthetic Data Vault Project
- Website: https://sdv.dev
- Documentation: https://sdv.dev/SDV