SDGym
Ask or search…
K
Links

Metadata

This guide describes the SDGym's metadata specification for a single table of data.

What is metadata?

Metadata is a basic, factual description of a dataset that includes:
  • The type of data that each column represents
  • The primary keys and other identifiers of the table
How does the SDGym library use metadata? Many of the synthesizer use information in the metadata to create higher quality synthetic data. For example, the SDV Synthesizers apply different logic to different column types.
Additionally, the evaluation framework factors in the metadata when applying metrics. For example, some metrics may only be applicable for specific column types.
The SDGym library expects that every dataset will have corresponding metadata provided as a JSON file. During benchmarking, the SDGym reads the file as a Python dictionary.

Example

We assume that the data is present in a CSV format that describes rows and columns of a single table.
This example of a single table includes a new row for each user. The row includes their personal information.
Click to see the table's metadata
This is the metadata dictionary for the illustrated table.
{
"primary_key": "user_id",
"columns": {
"user_id": { "sdtype": "id", "regex": "U_[0-9]{3}" },
"age": { "sdtype": "numerical" },
"address": { "sdtype": "street_address" },
"tier": { "sdtype": "categorical" },
"active": { "sdtype": "boolean"
},
"paid_amt": { "sdtype": "numerical" },
"renew_date": { "sdtype": "datetime", "datetime_format": "%Y-%m-%d" }
}
}

Metadata Specification

The metadata has two keys:
  • "primary_key": the column name used to identify a row in the table
  • (required) "columns": a dictionary description of each column
{
"primary_key": "user_id",
"columns": { <column information> }
}

Column Information (Fields)

The "columns" key describes each column. It contains the name of the column, followed by the type of data and any other information about it. There are specific data types to choose from.
boolean
categorical
datetime
numerical
id
other
Boolean columns represent True or False values.
"active" : {
"sdtype": "boolean"
}
Properties (None)
Categorical columns represent discrete data
"tier" : {
"sdtype": "categorical"
}
Properties (None)
Date columns represent a point in time
"renew_date": {
"sdtype": "datetime",
"datetime_format": "%Y-%m-%d"
}
Properties
The format string has special values to describe the components. For example, Jan 06, 2022 is represented as "%b %d, %Y"
See this documentation for a full list. Common values are:
  • Year: "%Y" for a 4-digit year like 2022, or "%y" for a 2-digit year like 22
  • Month: "%m" for a 2-digit month like 01, "%b" for an abbreviated month like Jan
  • Day: "%d" for a 2-digit day like 06
Numerical columns represents discrete or continuous numerical values.
"age": {
"sdtype": "numerical",
"computer_representation": "Int64"
},
"paid_amt": {
"sdtype": "numerical",
"computer_representation": "Float"
}
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'
Use "type": "numerical" to specify columns that represent whole number or continuous values
ID columns represent identifiers that do not have any special mathematical or semantic meaning
"user_id": {
"sdtype": "id",
"regex_format": "U_[0-9]{3}"
}
Properties
You can input any other data type such as 'phone_number', 'ssn' or 'email'. See the Sdtypes Reference for a full list.
"address": {
"sdtype": "address",
"pii": true
}
Properties
  • pii: A boolean denoting whether the data is sensitive
    • (default) true: The column is sensitive, meaning the values should be anonymized
    • false: The column is not sensitive, meaning the exact set of values can be reused in the synthetic data

FAQs

Should all the datasets include metadata?
Yes, every dataset available in the SDGym's demo module has an associated metadata file. If you are supplying custom datasets, make sure to write an attach a metadata file too. See Datasets for more information.
Can my custom synthesizer make use of the metadata?
Yes, your custom synthesizer can use any information in the metadata to help create higher quality synthetic data. The metadata information is passed into your synthesizer as a Python dictionary during the training process. See Custom Synthesizers for more information.
Last modified 5mo ago
© Copyright 2023, DataCebo, Inc.