
SDG: Synthetic Data Generator
====================================================================

.. raw:: html

   <p align="center">
   <a href="https://github.com/hitsz-ids/synthetic-data-generator">
   <img align="center" width=400 src="_static/sdg_logo.png"></img>
   </a>
   </p>

   <p align="center">
   <a href="https://github.com/hitsz-ids/synthetic-data-generator/actions"><img alt="Actions Status" src="https://github.com/hitsz-ids/synthetic-data-generator/actions/workflows/ci-test-python-package.yml/badge.svg"></a>
   <a href='https://synthetic-data-generator.readthedocs.io/en/latest/?badge=latest'><img src='https://readthedocs.org/projects/synthetic-data-generator/badge/?version=latest' alt='Documentation Status' /></a>
   <a href="https://results.pre-commit.ci/latest/github/hitsz-ids/synthetic-data-generator/main"><img alt="pre-commit.ci status" src="https://results.pre-commit.ci/badge/github/hitsz-ids/synthetic-data-generator/main.svg"></a>
   <a href="https://github.com/hitsz-ids/synthetic-data-generator/blob/main/LICENSE"><img alt="LICENSE" src="https://img.shields.io/github/license/hitsz-ids/synthetic-data-generator"></a>
   <a href="https://github.com/hitsz-ids/synthetic-data-generator/releases/"><img alt="Releases" src="https://img.shields.io/github/v/release/hitsz-ids/synthetic-data-generator"></a>
   <a href="https://github.com/hitsz-ids/synthetic-data-generator/releases/"><img alt="Pre Releases" src="https://img.shields.io/github/v/release/hitsz-ids/synthetic-data-generator?include_prereleases&label=pre-release&logo=github"></a>
   <a href="https://github.com/hitsz-ids/synthetic-data-generator"><img alt="Last Commit" src="https://img.shields.io/github/last-commit/hitsz-ids/synthetic-data-generator"></a>
   <a href="https://github.com/hitsz-ids/synthetic-data-generator"><img alt="Python version" src="https://img.shields.io/pypi/pyversions/sdgx"></a>
   <a href="https://github.com/hitsz-ids/synthetic-data-generator/contributors"><img alt="contributors" src="https://img.shields.io/github/all-contributors/hitsz-ids/synthetic-data-generator?color=ee8449&style=flat-square"></a>
   <a href="https://join.slack.com/t/hitsz-ids/shared_invite/zt-2395mt6x2-dwf0j_423QkAgGvlNA5E1g"><img alt="slack" src="https://img.shields.io/badge/slack-join%20chat-ff69b4.svg?style=flat-square"></a>
   </p>



The Synthetic Data Generator (SDG) is a specialized framework designed to generate high-quality structured tabular data. It incorporates a wide range of single-table, multi-table data synthesis algorithms and LLM-based synthetic data generation models.

Synthetic data, generated by machines using real data, metadata, and algorithms, does not contain any sensitive information, yet it retains the essential characteristics of the original data. There is no direct correlation between synthetic data and real data, making it exempt from privacy regulations such as GDPR and ADPPA. This eliminates the risk of privacy breaches in practical applications.

High-quality synthetic data can be safely utilized across various domains including data sharing, model training and debugging, system development and testing, etc.

Our CODE/ISSUE/PULL REQUESTS are all hosted on `github <https://github.com/hitsz-ids/synthetic-data-generator>`_. Feel free to contact us if you have any questions.

Installation
====================================================================

You can install our python package with pip,

.. code-block:: bash

    pip install sdgx


Or use pre-built images to quickly experience the latest features.

.. code-block:: bash

    docker pull idsteam/sdgx:latest

In order to use the GPU for synthesis, you may need to refer to `Torch's GPU installation guide <https://pytorch.org/get-started/locally/>`_.


Quick demo
====================================================================

.. code-block:: python

   """
   Example for CTGAN
   """

   from sdgx.data_connectors.csv_connector import CsvConnector
   from sdgx.models.ml.single_table.ctgan import CTGANSynthesizerModel
   from sdgx.synthesizer import Synthesizer
   from sdgx.utils import download_demo_data

   # This will download demo data to ./dataset
   dataset_csv = download_demo_data()

   # Create data connector for csv file
   data_connector = CsvConnector(path=dataset_csv)

   # Initialize synthesizer, use CTGAN model
   synthesizer = Synthesizer(
      model=CTGANSynthesizerModel(epochs=1),  # For quick demo
      data_connector=data_connector,
   )

   # Fit the model
   synthesizer.fit()

   # Sample
   sampled_data = synthesizer.sample(1000)
   print(sampled_data)


We provided user guides with lots of examples for researchers, scientists and developers. Learn more if you are interested!

.. toctree::
   :maxdepth: 3
   :titlesonly:

   User guides <user_guides/index>



More details
====================================================================

.. toctree::
   :maxdepth: 3
   :titlesonly:

   Design <design/index>
   Developer guides <developer_guides/index>
   API Reference <api_reference/index>


Indices and tables
====================================================================

* :ref:`genindex`
* :ref:`search`
