How to use the rdt.transformers.OneHotEncodingTransformer function in rdt

To help you get started, we’ve selected a few rdt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HDI-Project / SDV / sdv / tabular / copulas.py View on Github external
'type': 'str',
            'default': 'categoircal_fuzzy',
            'description': 'Type of transformer to use for the categorical variables',
            'choices': [
                'categorical',
                'categorical_fuzzy',
                'one_hot_encoding',
                'label_encoding'
            ]
        }
    }
    DEFAULT_TRANSFORMER = 'one_hot_encoding'
    CATEGORICAL_TRANSFORMERS = {
        'categorical': rdt.transformers.CategoricalTransformer(fuzzy=False),
        'categorical_fuzzy': rdt.transformers.CategoricalTransformer(fuzzy=True),
        'one_hot_encoding': rdt.transformers.OneHotEncodingTransformer,
        'label_encoding': rdt.transformers.LabelEncodingTransformer,
    }
    TRANSFORMER_TEMPLATES = {
        'O': rdt.transformers.OneHotEncodingTransformer
    }

    def __init__(self, distribution=None, categorical_transformer=None, *args, **kwargs):
        super().__init__(*args, **kwargs)

        if self._metadata is not None and 'model_kwargs' in self._metadata._metadata:
            model_kwargs = self._metadata._metadata['model_kwargs']
            if distribution is None:
                distribution = model_kwargs['distribution']

            if categorical_transformer is None:
                categorical_transformer = model_kwargs['categorical_transformer']