Syndat
Syndat is a python package that provides functionalities for the evaluation and visualization of synthetic data.
Cite this software
Description
About
Syndat is a software package that provides basic functionalities for the evaluation and visualisation of synthetic data. Quality scores can be computed on 3 base metrics (Discrimation, Correlation and Distribution) and data may be visualized to inspect correlation structures or statistical distribution plots.
Syndat also allows users to generate stratified and interpretable visualisations, including raincloud plots, GOF plots, and trajectory comparisons, offering deeper insights into the quality of synthetic clinical data across different subgroups.
Installation
Install via pip:
pip install syndat
Usage
Fidelity metrics
Jenson-Shannon Distance
The Jenson-Shannon distance is a measure of similarity between two probability distributions. In our case, we compute probability distributions for each feature in the datasets and can thus compare the statistic feature similarity of two dataframes.
It is bounded between 0 and 1, with 0 indicating identical distributions.
(Normalized) Correlation Difference
In addition to statistical similarity between the same features, we also want to make sure to preserve the correlations across different features. The normalized correlation difference measures the similarity of the correlation matrix of two dataframes.
A low correlation difference near zero indicates that the correlation structure of the synthetic data is similar to the real data.
Discriminator AUC
A classifier is trained to discriminate between real and synthetic data. Based on the Receiver Operating Characteristic (ROC) curve, we compute the area under the curve (AUC) as a measure of how well the classifier can distinguish between the two datasets.
An AUC of 0.5 indicates that the classifier is unable to distinguish between the two datasets, while an AUC of 1.0 indicates perfect discrimination.
Exemplary usage:
import pandas as pd
from syndat.metrics import (
jensen_shannon_distance,
normalized_correlation_difference,
discriminator_auc
)
real = pd.DataFrame({
'feature1': [1, 2, 3, 4, 5],
'feature2': ['A', 'B', 'A', 'B', 'C']
})
synthetic = pd.DataFrame({
'feature1': [1, 2, 2, 3, 3],
'feature2': ['A', 'B', 'A', 'C', 'C']
})
print(jensen_shannon_distance(real, synthetic))
>> {'feature1': 0.4990215421876156, 'feature2': 0.22141025172133794}
print(normalized_correlation_difference(real, synthetic))
>> 0.24571345029108108
print(discriminator_auc(real, synthetic))
>> 0.6
Scoring Functions
For convenience and easier interpretation, a normalized score can be computed for each of the metrics instead:
# JSD score is being aggregated over all features
distribution_similarity_score = syndat.scores.distribution(real, synthetic)
discrimination_score = syndat.scores.discrimination(real, synthetic)
correlation_score = syndat.scores.correlation(real, synthetic)
Scores are defined in a range of 0-100, with a higher score corresponding to better data fidelity.
Visualization
Visualize real vs. synthetic data distributions, summary statistics and discriminating features:
import pandas as pd
import syndat
real = pd.read_csv("real.csv")
synthetic = pd.read_csv("synthetic.csv")
# plot *all* feature distribution and store image files
syndat.visualization.plot_distributions(real, synthetic, store_destination="results/plots")
syndat.visualization.plot_correlations(real, synthetic, store_destination="results/plots")
# plot and display specific feature distribution plot
syndat.visualization.plot_numerical_feature("feature_xy", real, synthetic)
syndat.visualization.plot_numerical_feature("feature_xy", real, synthetic)
# plot a shap plot of differentiating feature for real and synthetic data
syndat.visualization.plot_shap_discrimination(real, synthetic)
Postprocessing
Postprocess synthetic data to improve data fidelity:
import pandas as pd
import syndat
real = pd.read_csv("real.csv")
synthetic = pd.read_csv("synthetic.csv")
# postprocess synthetic data
synthetic_post = syndat.postprocessing.assert_minmax(real, synthetic)
synthetic_post = syndat.postprocessing.normalize_float_precision(real, synthetic)
Evaluation and Visualization of Synthetic Clinical Trial Data
An example demonstrating how to compute distribution, discrimination, and correlation scores, as well as how to generate stratified visualizations (gof, raincloud and other plots), is available in examples/rct_example.py.
Acknowledgements
This work was done as part of the NFDI4Health Consortium.
It is currently also being extended as part of the SYNTHIA collaboration.
Participating organisations
Reference papers
- 1.Author(s): Sobhan Moazemi, Tim Adams, Hwei Geok NG, Lisa Kühnel, Julian Schneider, Anatol-Fiete Näher, Juliane Fluck, Holger FröhlichPublished by arXiv in 202410.48550/arxiv.2408.04478
- 2.Author(s): Tim Adams, Colin Birkenbihl, Karen Otte, Hwei Geok Ng, Jonas Adrian Rieling, Anatol-Fiete Näher, Ulrich Sax, Fabian Prasser, Holger Fröhlich, Alzheimer’s Disease Neuroimaging InitiativePublished in 202410.1101/2024.12.06.24317239
Mentions
- 1.Author(s): Yue Qi, Lorrie Herbault, Hadrien Lautraite, Michael Yu, Katleen Blanchet, Christian Vincelette, Louis Mullie, Guillaume Dumas, Jean-François Rajotte, Kamran Afzali, Sébastien Gambs, Michaël ChasséPublished in 202610.1016/j.ailsci.2026.100155
- 2.Author(s): Francisco Ortuño, Víctor M. de la Oliva Roque, Javier‐Ignacio Ramirez‐Lopez, David P. Kreil, Joaquín Dopazo, Carlos LouceraPublished in 202610.1002/advs.202516196
- 3.Author(s): Jieren Luo, Jiesen Yu, Zihao Cai, Ling Xu, Yinghua Lv, Qingshan Zheng, Lujin LiPublished in 202610.1007/s00228-026-04032-8
- 4.Author(s): Katariina Perkonoja, Parisa Movahedi, Antti Airola, Kari Auranen, Joni VirtaPublished in 202610.1016/j.jbi.2026.105074
- 5.Author(s): Mehmed Halilovic, Thierry Meurers, Marco Alibone, Marion Ludwig, Paul Tiwald, Nico Sieberg-Riedel, Steven Wolter, Lisa Kühnel, Steffen Hess, Fabian Prasser, Karen OttePublished in 202610.1038/s41746-026-02622-5
- 6.Author(s): Ally Nyamawe, Deo ShaoPublished in 202610.1177/20552076261418897
- 7.Author(s): JaeCheol Kim, Seungun Park, Jaesik Cha, Eunyeong Son, Yunsik SonPublished in 202510.3390/app151910609
- 8.Author(s): Lisa Pilgram, Haksoo Ko, Adeline Tung, Khaled El EmamPublished in 202510.1038/s41746-025-02112-0
- 9.Author(s): Soonseok KimPublished in 202510.3390/electronics14214350
- 10.Author(s): Akash Ghosh, Raghav Jain, Anubhav Jhangra, Sriparna Saha, Adam JatowtPublished in 202510.1002/widm.70045
- 11.Author(s): Lisa Pilgram, Fida Kamal Dankar, Jörg Drechsler, Mark Elliot, Josep Domingo-Ferrer, Paul Francis, Murat Kantarcioglu, Linglong Kong, Bradley Malin, Krishnamurty Muralidhar, Puja Myles, Fabian Prasser, Jean Louis Raisaro, Chao Yan, Khaled El EmamPublished in 202510.1016/j.patter.2025.101320
- 12.Author(s): Echo H. Wang, Puja Myles, Randi Foraker, Sengwee Toh, Lucy Mosquera, Khaled El Emam, Mehmet BurcuPublished in 202510.1038/s41746-025-02126-8
- 13.Author(s): Tinja Pitkämäki, Tapio Pahikkala, Ileana Montoya Perez, Parisa Movahedi, Valtteri Nieminen, Tom Southerington, Juho Vaiste, Mojtaba Jafaritadi, Muhammad Irfan Khan, Elina Kontio, Pertti Ranttila, Juha Pajula, Harri Pölönen, Aysen Degerli, Johan Plomp, Antti AirolaPublished in 202410.3934/aci.2024009
- 1.Author(s): Khaled Hamad, Yazeed Alsarhan, Anas Alomari, Karam Hassan, Areen Arabiat, Hamza Abu Owida, Mowafaq Salem AlzboonPublished in 202610.1109/icsmile69273.2026.11519272
- 2.Author(s): Hakime Öztürk, Tejumade Afonja, Joonas Jälkö, Ruta Binkyte, Pablo Rodriguez-Mier, Sebastian Lobentanzer, Andrew Wicks, Jules Kreuer, Sofiane Ouaari, Nico Pfeifer, Shane Menzies, Sikha Pentyala, Daniil Filienko, Steven Golob, Patrick McKeever, Jineta Banerjee, Luca Foschini, Martine De Cock, Julio Saez-Rodriguez, Mario Fritz, Oliver Stegle, Antti HonkelaPublished in 202610.64898/2026.03.02.707794
- 3.Author(s): Alejandro Correa Rojo, Yves Moreau, Gökhan ErtaylanPublished in 202510.1101/2025.10.17.682995
- 4.Author(s): Marko Miletic, Murat SariyarPublished in 202510.1186/s12911-025-03326-8
- 5.Author(s): Md Faisal Ahmed, Zhengdao WangPublished in 202510.1109/tps-isa67132.2025.00018
- 6.Author(s): Md Faisal Ahmed, Zhengdao WangPublished in 202510.1109/tps-isa67132.2025.00035