FixedCombinations
The FixedCombinations constraint enforces that the combinations between a set of columns are fixed. That is, no other permutations or shuffling is allowed other than what's already observed in the data.
Constraint API
Create a FixedCombinations
constraint.
Parameters:
(required)
column_names
: A list of two or more columns whose combinations are fixed. The columns must be categorical. The SDV will not further shuffle the data between these column names.table_name
: A string with the name of the table to apply this to. Required if you have a multi-table dataset.
from sdv.cag import FixedCombinations
my_constraint = FixedCombinations(
column_names=['city', 'country']
)
Usage
Apply the constraint to any SDV synthesizer. Then fit and sample as usual.
synthesizer = GaussianCopulaSynthesizer(metadata)
synthesizer.add_constraints([my_constraint])
synthesizer.fit(data)
synthetic_data = synthesizer.sample()
For more information about using predefined constraints, please see the Constraint-Augmented Generation tutorial.
FAQs
Last updated