Metadata
Metadata is a description of your dataset. It helps the library understand the type and format of your data, so that it can apply the correct metrics.
If the metadata is incorrect, this library may apply the wrong metrics to your data which leads to inaccurate scores.
What does metadata include?
Your metadata includes:
The type of data that each column represents
The primary keys and other identifiers of the table
The relationships between the tables, if you have multiple tables
Write your metadata once and use it anywhere in the SDMetrics library.
If you used the SDV library to create your metadata, you can reuse the same file for SDMetrics.
For example, your data may be present in multiple tables with rows and columns. The tables may be connected to each other through primary and foreign key references.

Your data description is called metadata. SDMetrics expects metadata as a Python dictionary object.
Metadata Specification
The file is an object that includes a dictionary named "tables".
Tables
The "tables" dictionary contains the information about each individual table of your application. Its keys are the table names and the values are dictionaries that describe each single table. This includes:
"primary_key": the column name used to identify a row in your table. For a composite key, provide a list of column names.(required)
"columns": a dictionary description of each column
Column Information
Inside "columns", you will describe each column. You'll start with the name of the column. Then you'll specify the type of data and any other information about it.
There are specific data types to choose from. Expand the options below to learn about the data types.
Boolean columns represent True or False values.
Properties (None)
Categorical columns describe discrete data.
Properties (None)
Date columns represent a point in time
Properties
datime_format: A string describing the format as defined by Python's strftime module. This is required if your datetime columns are represented as strings.
Numerical columns represents discrete or continuous numerical values.
Properties
computer_representation: A string that represents how you'll ultimately store the data. This determines the min and max values allowed Available options are:'Float','Int8','Int16','Int32','Int64','UInt8','UInt16','UInt32','UInt64'
ID columns represent identifiers that do not have any special mathematical or semantic meaning
Properties
regex_format: A string describing the format of the ID as a regular expression
You can input any other data type such as 'phone_number', 'ssn' or 'email'. See the Sdtypes Reference for a full list.
Properties
pii: A boolean denoting whether the data is sensitive(default)
True: The column is sensitive, meaning the synthetic data is anonymizedFalse: The column is not sensitive, meaning the synthetic data may not be anonymized
Relationships
Inside the "relationships" section of the metadata, provide a list of relationships that exist between tables. Each relationship is represented as a dictionary with the following keys:
"parent_table_name": The name of the parent table"parent_primary_key": The primary key column in the parent table. This column uniquely identifies each row in the parent table. For a composite key, provide a list of column names."child_table_name": The name of the child table that refers to the parent"child_foreign_key": The foreign key column in the child table. The values in this column contain a reference to a row in the parent table. For a composite key, provide a list of column names.
Use multiple dictionaries to represent multiple tables.
Saving & Loading Metadata
After creating your dictionary, you can save it as a JSON file. For example, my_metadata_file.json.
In the future, you can load the Python dictionary by reading from the file.
Adding Multi-Sequence Information
In some cases, your data table may contain multiple, independent sequences belonging to different entities. See the diagram below for an illustration of sequential data.

In this case, you can add some information about the sequential nature of this data to your metadata specification. In the dictionary for the table, add:
"sequence_key": the name of a column that identifies each unique sequence in your data"sequence_index": the column name used to order the rows in the table
An example for the table is provided below.
At this time, SDMetrics offers limited evaluation support for data involving sequences. You may run the Diagnostic and Quality reports with your data, but these reports do not factor in any order or sequence-related measures.
In addition to the report, you can run individual metrics that are suited for sequential data. See:
Metrics in Beta: Sequential Detection, Sequential ML Efficacy
Last updated
