Danger

You are looking at the documentation for an older version of the SDV! We are no longer supporting or maintaining this version of the software

Click here to go to the new docs pages.

sdv.constraints.FixedCombinations

class sdv.constraints.FixedCombinations(column_names)[source]

Ensure that the combinations across multiple columns are fixed.

One simple example of this constraint can be found in a table that contains the columns country and city, where each country can have multiple cities and the same city name can even be found in multiple countries, but some combinations of country/city would produce invalid results.

This constraint would ensure that the combinations of country/city found in the sampled data always stay within the combinations previously seen during training.

Parameters

column_names (list[str]) – Names of the columns that need to produce fixed combinations. Must contain at least two columns.

__init__(column_names)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(column_names)

Initialize self.

filter_valid(table_data)

Get only the rows that are valid.

fit(table_data)

Fit Constraint class to data.

fit_transform(table_data)

Fit this Constraint to the data and then transform it.

from_dict(constraint_dict)

Build a Constraint object from a dict.

is_valid(table_data)

Say whether the column values are within the original combinations.

reverse_transform(table_data)

Handle logic around reverse transforming constraints.

to_dict()

Return a dict representation of this Constraint.

transform(table_data)

Perform necessary transformations needed by constraint.

Attributes

constraint_columns