Problem Description
In #873, we consolidated what was previously "single-table" vs "multi-table" metadata into a single, unified metadata definition. This is now visible in the docs.
The problem is that some existing metrics required only single-table metadata to be inputted -- as they were meant only to be run on single tables. Now that we have a unified metadata, there is an edge case: If the (unified) metadata describes several tables and you were to run one of these metrics, what should happen?
The way it's implemented in different metrics can be confusing. For example in the EqualizedOdds metric, SDMetrics only parses the first table listed in the metadata and uses it. There is no way to let SDMetrics know to use a different table.
Expected behavior
For the metrics that require metadata and run on a single table of data: Add a parameter called table_name, which is a string that describes which table must be run. This way even if there are multiple tables in the metadata, users would still be able to run the metric on a particular table inside of it.
The affected metrics are:
Notes:
- The
table_name parameter should come right after the metadata parameter.
- If the
metadata is optional, then table_name is also be optional. If metadata is required for the metric, then table_name should also be required.
- If
metadata is provided and contains multiple tables, then table_name must be provided. Otherwise, error out and ask for a table name.
from sdmetrics.single_table import NewRowSynthesis
NewRowSynthesis.compute(
real_data=real_table,
synthetic_data=synthetic_table,
metadata=metadata,
table_name='users',
numerical_match_tolerance=0.01,
synthetic_sample_size=10_000
)
Problem Description
In #873, we consolidated what was previously "single-table" vs "multi-table" metadata into a single, unified metadata definition. This is now visible in the docs.
The problem is that some existing metrics required only single-table metadata to be inputted -- as they were meant only to be run on single tables. Now that we have a unified metadata, there is an edge case: If the (unified) metadata describes several tables and you were to run one of these metrics, what should happen?
The way it's implemented in different metrics can be confusing. For example in the EqualizedOdds metric, SDMetrics only parses the first table listed in the metadata and uses it. There is no way to let SDMetrics know to use a different table.
Expected behavior
For the metrics that require metadata and run on a single table of data: Add a parameter called
table_name, which is a string that describes which table must be run. This way even if there are multiple tables in the metadata, users would still be able to run the metric on a particular table inside of it.The affected metrics are:
Notes:
table_nameparameter should come right after themetadataparameter.metadatais optional, thentable_nameis also be optional. Ifmetadatais required for the metric, thentable_nameshould also be required.metadatais provided and contains multiple tables, thentable_namemust be provided. Otherwise, error out and ask for a table name.