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.
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.
OneHotEncoding
Ensure the appropriate columns are one hot encoded.
This constraint allows the user to specify a list of columns where each row is a one hot vector. During the reverse transform, the output of the model is transformed so that the column with the largest value is set to 1 while all other columns are set to 0.
column_names (list[str]) – Names of the columns containing one hot rows.
__init__
Initialize self. See help(type(self)) for accurate signature.
Methods
__init__(column_names)
Initialize self.
filter_valid(table_data)
filter_valid
Get only the rows that are valid.
fit(table_data)
fit
Fit Constraint class to data.
Constraint
fit_transform(table_data)
fit_transform
Fit this Constraint to the data and then transform it.
from_dict(constraint_dict)
from_dict
Build a Constraint object from a dict.
is_valid(table_data)
is_valid
Check whether the data satisfies the one-hot constraint.
reverse_transform(table_data)
reverse_transform
Handle logic around reverse transforming constraints.
to_dict()
to_dict
Return a dict representation of this Constraint.
transform(table_data)
transform
Perform necessary transformations needed by constraint.
Attributes
constraint_columns