OneHotEncoding

Compatibility: Multiple numerical columns that contain 0/1 values

The OneHotEncoding constraint enforces that a set of columns follow a one hot encoding scheme↗. That is, exactly one of the columns must contain a value of 1 while all the others must be 0.

Parameters

(required) column_names: A list of column names that, together, form the one hot encoding scheme

Example

Define your constraint using the parameters and then add it to a synthesizer.

my_constraint = {
    'constraint_class': 'OneHotEncoding',
    'table_name': 'users', # for multi table synthesizers
    'constraint_parameters': {
        'column_name': 'subscription_status'
    }
}

my_synthesizer.add_constraints(constraints=[
    my_constraint
])

Last updated

Copyright (c) 2023, DataCebo, Inc.