FixedIncrements
The FixedIncrements constraint enforces that all the values in a column are increments of a particular, fixed value. That is, all the data must be divisible by the value.
Constraint API
Parameters
(required)
column_name
: The name of the column that must follow the constraint. This must be a numerical column.(required)
increment
: The size of the increment. This must be a positive integertable_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 FixedIncrements
my_constraint = FixedIncrements(
column_name='salary',
increment=1000
)
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