这是一个库,用于利用条件生成对抗网络 (GAN) 与差分隐私技术生成合成表格数据或 RDF 数据。
Abstract: This repository presents a Conditional Generative Adversary Networks (GANs) on tabular data (and RDF data) combining with Differential Privacy techniques. Our pre-print publication: Generating synthetic personal health data using conditional generative adversarial networks combining with differential privacy.
Author: Chang Sun, Institute of Data Science, Maastricht University Start date: Nov-2021 Status: Under development
Note: "Standing on the shoulders of giants". This repository is inspired by the excellent work of CTGAN from Synthetic Data Vault (SDV), Tensorflow Privacy, and RdfPdans. Highly appreciate they shared the ideas and implementations, made code publicly available, well-written documentation. More related work can be found in the References below.
This package is extended from SDV (https://github.com/sdv-dev/SDV), CTGAN (https://github.com/sdv-dev/CTGAN), and Differential Privacy in GANs (https://github.com/civisanalytics/dpwgan). The author modified the conditional matrix and cost functions to emphasize on the relations between variables. The main changes are in ctgan/synthesizers/ctgan.py ../data_sampler.py ../data_transformer.py
You will need Python >=3.8+
pip3 install -U dp-cgansYou can easily generate synthetic data for a file using your terminal after installing dp-cgans with pip.
To quickly run our example, you can download the example data:
wget https://raw.githubusercontent.com/sunchang0124/dp_cgans/main/resources/example_tabular_data_UCIAdult.csvThen run dp-cgans:
dp-cgans gen example_tabular_data_UCIAdult.csv --epochs 100 --output out.csv --gen-size 100Get a full rundown of the available options for generating synthetic data with:
dp-cgans gen --helpThis library can also be used directly in python scripts
If your input is tabular data (e.g., csv):
…bash hatch -v run dp-cgans gen --help
You can also enter a new shell with the virtual environments automatically activated:
```bash
hatch shell
dp-cgans gen --helpRun the tests locally:
hatch run pytest -sRun formatting and linting (black and ruff):
hatch run fmtIn case the virtual environments is not updating as expected you can easily reset it with:
hatch env pruneThe deployment of new releases is done automatically by a GitHub Action workflow when a new release is created on GitHub. To release a new version:
Make sure the PYPI_API_TOKEN secret has been defined in the GitHub repository (in Settings > Secrets > Actions). You can get an API token from PyPI here.
Increment the version number in src/dp_cgans/__init__.py file:
hatch version fix # Bump from 0.0.1 to 0.0.2
hatch version minor # Bump from 0.0.1 to 0.1.0
hatch version 0.1.1 # Bump to the specified versionCreate a new release on GitHub, which will automatically trigger the publish workflow, and publish the new release to PyPI.
You can also manually build and publish from you laptop:
hatch build
hatch publishThere are many excellent work on generating synthetic data using GANS and other methods. We list the studies that made great conbributions for the field and inspiring for our work.
暂无开放 Issues,或尚未同步最近议题。