Links

Visualization Utilities

Use the utilities below to visualize the comparison between real and synthetic data. You can access these from the sdmetrics.reports module.
Tip! All visualizations are interactive. If you're using an iPython notebook, you can zoom, pan, toggle legends and take screenshots.

Compare a synthetic column & real column (1D)

utils.get_column_plot
Use this utility to visualize a real column against the same synthetic column. You can plot any column of type: boolean, categorical, datetime or numerical.
  • (required) real_data: A pandas.DataFrame containing the table of your real data
  • (required) synthetic_data: A pandas.DataFrame containing the synthetic data
  • (required) column_name: The name of the column you want to plot.
  • (required) metadata: A dictionary of Single Table Metadata
Returns: A plotly.Figure object
from sdmetrics.reports import utils
fig = utils.get_column_plot(
real_data=real_table,
synthetic_data=synthetic_table,
column_name='high_perc',
metadata=my_table_metadata_dict
)
fig.show()
If you have Multi Table Metadata, you can access the single table using the 'tables' key. For example if your table name is 'transactions', use:
my_multi_table_metadata_dict['tables']['transactions']

Compare a pair of synthetic columns & real columns (2D)

utils.get_column_pair_plot
Use this utility to visualize the trends between a pair of columns for real and synthetic data. You can plot any 2 columns of type: boolean, categorical, datetime or numerical. The columns do not have to the be the same type.
  • (required) real_data: A pandas.DataFrame containing the table of your real data
  • (required) synthetic_data: A pandas.DataFrame containing the synthetic data
  • (required) column_names: A list containing the names of the 2 columns you want to plot.
  • (required) metadata: A dictionary of Single Table Metadata
Returns: A plotly.Figure object
from sdmetrics.reports import utils
fig = utils.get_column_pair_plot(
real_data=real_table,
synthetic_data=synthetic_table,
column_names=['mba_perc', 'degree_perc'],
metadata=my_table_metadata_dict
)
fig.show()
Various types of plots are possible based on the types of data you provide
If you have Multi Table Metadata, you can access a single table using the 'tables' key. For example if your table name is 'transactions', use:
my_multi_table_metadata_dict['tables']['transactions']

Visualize the cardinality of a relationship

utils.get_cardinality_plot
Use this utility to visuaize the cardinality of parent-child relationship. The cardinality is the # of children that each parent row has. Your cardinality may be fixed (eg. every parent has exactly 2 children) or variable (eg. every parent has 1-3 children).
  • (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) parent_table_name: The string name of the parent table in the relationship
  • (required) child_table_name: The string name of the child table in the relationship
  • (required) child_foreign_key: The string name of the column in the child table that refers to the parent's primary key
  • (required) metadata: A dictionary of Multi Table Metadata
Returns: A plotly.Figure object
from sdmetrics.reports import utils
fig = utils.get_cardinality_plot(
real_data=real_tables,
synthetic_data=synthetic_tables,
parent_table_name='users',
child_table_name='transactions'
child_foreign_key='payor_id',
metadata=my_table_metadata_dict
)
fig.show()