Esempio n. 1
0
    def _fit(self, table_data):
        """Fit the model to the table.

        Args:
            table_data (pandas.DataFrame):
                Data to be learned.
        """
        distributions = self._field_distributions
        fields = self._metadata.get_fields()

        transformers = {}
        for field in table_data:
            field_name = field.replace('.value', '')

            if field_name in fields and fields.get(
                    field_name,
                    dict(),
            ).get('type') != 'categorical':
                transformers[field] = GaussianCopulaTransformer(
                    distribution=distributions.get(field_name,
                                                   self._default_distribution))

        self._ht = HyperTransformer(field_transformers=transformers)
        table_data = self._ht.fit_transform(table_data)

        super()._fit(table_data)
Esempio n. 2
0
    def _fit(self, table_data):
        """Fit the model to the table.

        Args:
            table_data (pandas.DataFrame):
                Data to be learned.
        """
        distributions = self._field_distributions
        default = self._default_distribution
        fields = self._metadata.get_fields()
        transformers = {
            field: GaussianCopulaTransformer(
                distribution=distributions.get(field, default))
            for field in table_data.columns
            if fields.get(field, dict()).get('type') != 'categorical'
        }
        self._ht = HyperTransformer(transformers=transformers)
        table_data = self._ht.fit_transform(table_data)

        super()._fit(table_data)