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.
❖ Auto-Detection
Auto-detection is allowed for this constraint but it is not enabled by default. We recommend auto-detecting the FixedNullCombinations constraint instead, as it covers all the logic of this constraint and more!
If you'd like to auto-detect this constraint specifically, you can supply it in the auto-detection parameters. This will detect all instances of the constraint throughout the dataset.
Detection Parameters: None
FAQs
Last updated