Data Quality
Quality checks compare the statistical similarity between the real and synthetic data. Run through these to evaluate whether the synthetic data captures patterns from the real data. We don't expect the scores to be a perfect, 100%, but the results can point you towards the strengths and weaknesses of your synthesizer.
Quality Report
The Quality Report checks for statistical similarity between the real and the synthetic data for all the tables. Use this to discover which patterns the synthetic data has captured from the real data
evaluate_quality
Use this function to evaluate the quality of your synthetic data.
from sdv.evaluation import evaluate_quality
quality_report = evaluate_quality(
real_data=real_data,
synthetic_data=synthetic_data,
metadata=metadata)Generating report ...
(1/4) Evaluating Column Shapes: |██████████| 15/15 [00:00<00:00, 564.15it/s]|
Column Shapes Score: 85.61%
(2/4) Evaluating Column Pair Trends: |██████████| 55/55 [00:00<00:00, 110.40it/s]|
Column Pair Trends Score: 71.97%
(3/4) Evaluating Cardinality: |██████████| 1/1 [00:00<00:00, 53.27it/s]|
Cardinality Score: 70.0%
(4/4) Evaluating Intertable Trends: |██████████| 50/50 [00:00<00:00, 86.54it/s]|
Intertable Trends Score: 68.49%
Overall Score (Average): 74.02%Parameters:
(required)
real_data: The original training data. For single table data, this is a pandas.DataFrame. For multi table data, this is a dictionary mapping each table name (string) to a pandas.DataFrame containing the data.(required)
synthetic_data: Your synthetic data. For single table data, this is a pandas.DataFrame. For multi table data, this is a dictionary mapping each table name (string) to a pandas.DataFrame containing the data.(required)
metadata: A Metadata object with your metadataverbose: A boolean describing whether or not to print the report progress and results. Defaults toTrue. Set this toFalseto run the report silently.
Returns: An SDMetrics QualityReport object generated with your real and synthetic data
Interpreting the Score
Your score will vary from 0% to 100%. This value tells you how similar the synthetic data is to the real data.
A 100% score means that the patterns are exactly the same. For example, if you compared the real data with itself (identity), the score would be 100%.
A 0% score means the patterns are as different as can be. This would entail that the synthetic data purposefully contains anti-patterns that are opposite from the real data.
Any score in the middle can be interpreted along this scale. For example, a score of 80% means that the synthetic data is about 80% similar to the real data — about 80% of the trends are similar.
The quality score is expected to vary, and you may never achieve exactly 100% quality. That's ok! The SDV synthesizers are designed to estimate patterns, meaning that they may smoothen, extrapolate, or noise certain parts of the data. For more information, see the FAQs.
The different types of data quality are summarized in the table below.
Column Shapes
The statistical similarity between the real and synthetic data for single columns of data. This is often called the marginal distribution of each column.
Column Pair Trends
The statistical similarity between the real and synthetic data for pairs of columns (within the same table). This is often called the correlation or bivariate distributions of the columns.
Cardinality
For multi-table data only. Within each parent/child relationship, the cardinality refers to the number of children that each parent has.
Intertable Trends
For multi-table data only. This is similar to column pair trends, but instead refers to columns between different tables. For example a column between a parent table and a different column in a child table.
get_details
This function returns details about the report's properties. Use it to pinpoint the exact columns or tables that are causing issues.
Parameters:
(required)
property_name: A string with the name of the property. One of:'Column Shapes','Column Pair Trends','Cardinality'or'Intertable Trends'.table_name: For multi table data, a string with the name of the table. If provided, you'll receive filtered results for the table.
Returns A pandas.DataFrame object with the detailed scores
save
Use this function to save the report object
The report does not save the full real and synthetic datasets. But we still recommend using caution when deciding when to store the report and who to share it with. It does save the metadata along with the score for each property, breakdown and metric.
Parameters:
(required)
filepath: The name of file to save the object. This must end with.pkl
Returns (None) Saves the report as a file
QualityReport.load
Use this function to load in a previously-saved quality report.
Parameters:
(required)
filepath: The name of the file where the report is stored
Returns An SDMetrics QualityReport object
FAQs
See the SDMetrics QualityReport for even more details about the metrics and properties included in the report.
Last updated