Synthetic Data Generation
Exploring the Streamlit App introduced in ydata-synthetic
Generating synthetic data is increasingly becoming a fundamental task to master as we move towards a Data-Centric paradigm of AI development.
on (e.g., missing data, imbalanced data, noisy data), yet one of the most common is encompassing heterogeneous (or “mixed”) data, i.e., data that comprises both numeric and categorical features.
As each feature type may come with its own intrinsic characteristics, heterogeneous data raises additional challenges to the process of synthetic data generation.
, has proven to be more robust and generalizable for a variety of datasets.
Throughout this article, we’ll dissect the properties of this architecture that make it so different and performant for tabular data, and why and when you should leverage it.
Real-World Tabular Heterogeneous Data
Real-world domains are often described by what we call “tabular data”, i.e., data that can be structured and organized in a table-like format.
As a standard, features (sometimes called “variables” or “attributes”) are represented in columns, whereas observations (or “records”) correspond to the rows.
Additionally, real-world data usually comprises both numeric and categorical features.
Numeric features (also called “continuous”) are those that encode quantitative values, whereas categorical (also called “discrete”) represent qualitative measurements.
Here’s an example of the under the formulation, research has been proposing modifications to the original architecture, new loss functions, or optimization strategies to address specific GAN limitations.
For instance, certain architectures such as introduced significant improvements to GAN in what concerns training stability and convergence time. repository for a curated list of open-source tools!
When it comes to learning and experimenting with new libraries, I’m all for an easy and intuitive experience: if there’s a UI, even better.
For synthetic data generation, ydata-synthetic has recently introduced a Streamlit app that lets us conduct a complete flow from data reading to profiling the newly generated synthetic data. Perfect!

The first step to get the UI running is installing ydata-synthetic. Don’t forget to add the “streamlit” extra:
pip install "ydata-syntehtic[streamlit]==1.0.1"
Then, you can open up a Python file and run:
from ydata_synthetic import streamlit_app
streamlit_app.run()
After running the above command, the console will output the URL from which you can access the app!
Train a Synthesizer Model
Training a synthesizer is straightforward: you can access the “Train a Synthesizer” tab and upload a file (again, I’m using the Adult Census Income dataset):

Once the file loads, we need to specify which features are numeric and categorical:

Then, we can select our synthesizer parameters, namely the model we intend to use and its parameters, such as batch size, learning rate, and additional settings (e.g. noise dimension, layer dimension, and the regularization constants beta).
Finally, we select the training parameters, namely the training epochs, and the training starts with a click of a button:

Note that I’m naturally using CTGAN in the example, but other models are currently supported such as GAN, WGAN, WGANGP, CRAMER, and DRAGAN.
Generate and Profile Synthetic Data Samples
To generate new synthetic samples, we can access the “Generate synthetic data” tab, choose the number of samples to generate and specify the filename where they’ll be saved.
Our model is saved and loaded by default as trained_synth.pkl but we can load a previously trained model by providing its path.

Additionally, I decided to generate a data profiling report to check the overall characteristics of the synthetic data, so I checked the “Generate synthetic data profiling” and the synthesization process starts by clicking “Generate Samples”:

The report is generated using the familiar , more advanced settings for CTGAN, and to discuss other data-related topics. See you there?
About me
Ph.D., Machine Learning Researcher, Educator, Data Advocate, and overall “jack-of-all-trades”. Here on Medium, I write about Data-Centric AI and Data Quality, educating the Data Science & Machine Learning communities on how to move from imperfect to intelligent data.
| | (2019). Advances in Neural Information Processing Systems, 32.
on Medium, where people are continuing the conversation by highlighting and responding to this story.
SOCIAL SHARE CARD GENERATOR