⭐Quality Report API
The SDMetrics Quality Report captures the statistical similarity between real data and synthetic data. If the synthetic and real data are statistically similar, we refer to the synthetic data as being high quality (aka high fidelity). The report runs select metrics to measure these properties and summarizes the results.
from sdmetrics.reports import QualityReport
report = QualityReport()
report.generate(real_data, synthetic_data, 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%Once you have generated the report you can get more details to explain the results, visualize the scores and save the report to share it.
Usage
Generating the report
QualityReport()
Create your report object by importing it from the multi table reports module.
generate(real_data, synthetic_data, metadata)
Generate your report by passing in the data and metadata.
(required)
real_data: A dictionary mapping the name of each table to a pandas.DataFrame containing the real data for that table(required)
synthetic_data: A dictionary mapping the name of each table to a pandas.DataFrame containing the synthetic data for that table(required)
metadata: A dictionary describing the format, types of data and relationship between the tables. See Metadata for more details.verbose: A boolean describing whether or not to print the report progress and results. Defaults toTrue. Set this toFalseto run the report silently.
Once completed, some preliminary scores will be printed out.
Getting & explaining the results
Every score that the report generates ranges from 0 (worst) to 1 (best)
get_score()
Use this method at any point to retrieve the overall score.
Returns: A floating point value between 0 and 1 that summarizes the quality of your synthetic data.
get_properties()
Use this method at any point to retrieve each property that the report evaluated
Returns: A pandas.DataFrame that lists each property name and its associated score
get_details(property_name, table_name)
Use this method to get more details about a particular property.
(required)
property_name: A string with the name of the property. One of:'Column Shapes','Column Pair Trends','Cardinality'or'Intertable Trends'table_name: A string with the name of the table. If provided, you'll receive filtered results for the table.
Returns: A pandas.DataFrame that returns more details about the property for the given table
For example, the details for 'Column Shapes' shows the name of each individual column, the metric that was used to compute it and the overall score for that column.
Visualizing the report
You can visualize the properties and use the SDMetrics utilities to visualize the raw data too.
get_visualization(property_name, table_name)
Use this method to visualize the details about a property.
(required)
property_name: A string with the name of the property. One of:'Column Shapes','Column Pair Trends','Cardinality'or'Intertable Trends'(required)
table_name: A string with the name of the table
Returns: A plotly.Figure object
The exact visualization is based on the property. For example, 'Column Shapes' property visualizes the quality score for every column as well as the metric used to compute it.

Saving & loading the report
You can save your report if you want to share or access it in the future.
save(filepath)
Save the Python report object
(required)
filepath: The name of file to save the object. This must end with.pkl
QualityReport.load(filepath)
Load the report from the file
(required)
filepath: The name of the file where the report is stored
Returns: A QualityReport object.
FAQs
Last updated
