Diagnostic Report

The Diagnostic Report is designed to capture basic diagnostic measurements across your entire dataset at once, reporting areas that may be problematic. Use this as a first step to ensuring that you have created valid synthetic data.

from sdmetrics.reports.single_table import DiagnosticReport

report = DiagnosticReport()
report.generate(real_data, synthetic_data, metadata)
Generating report ...

(1/2) Evaluating Data Validity: |██████████| 9/9 [00:00<00:00, 458.92it/s]|
Data Validity Score: 100.0%

(2/2) Evaluating Data Structure: |██████████| 1/1 [00:00<00:00, 104.60it/s]|
Data Structure Score: 100.0%

Overall Score (Average): 100.0%

How does it work?

The diagnostic report captures the Validity, Structure and Relationship Validity. This guide contains some technical details about each property.

Data Validity

Does each column in the data contain valid data?

Methodology

This property applies metrics based on the column types.

Column Type
Metric
Validity Check

primary keys

Primary keys must always be unique and non-null

numerical, datetime

Continuous values in the synthetic data must adhere to the min/max range in the real data

categorical, boolean

Discrete values in the synthetic data must adhere to the same categories as the real data.

This yields a separate score for every column. The final Data Validity score is the average of all columns.

Data Structure

Does each table have the same overall structure as the real data? The structure includes the column names.

Methodology

This property applies the TableStructure metric to each table of the dataset. This checks to see that there are the same set of column names in the synthetic vs. the real data.

Relationship Validity

This property is only available for multi table datasets.

Does the synthetic data contain valid relationships between different tables?

Methodology

Every relationship in your dataset is determined by a primary/foreign key connection. This property applies two metrics to the relationship to determine the validity:

  • ReferentialIntegrity: Does each foreign key refer to an existing primary key? If a foreign key refers to a non-existent primary key, it is known as an orphaned child, which is invalid in most databases.

  • CardinalityBoundaryAdherence: Does each primary key have the correct number of children? The correct number is based on the min/max bounds that are present in the real data.

The final Relationship Validity score is the average of all the sub scores.

Usage

If you have a single-table dataset, refer to the Single Table API. Pass in a DataFrame containing the real data and synthetic data.

from sdmetrics.reports.single_table import DiagnosticReport

report = DiagnosticReport()
report.generate(real_data, synthetic_data, metadata)

If you have a multi-table dataset, use the Multi Table API instead. This allows you to pass in a dictionary containing multiple, connected DataFrame objects.

from sdmetrics.reports.multi_table import DiagnosticReport

report = DiagnosticReport()
report.generate(real_data, synthetic_data, metadata)

Last updated