How to use the copulas.multivariate function in copulas

To help you get started, we’ve selected a few copulas 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 / models / copulas.py View on Github external
def fit(self, table_data):
        """Fit the model to the table.

        Impute the table data before fit the model.

        Args:
            table_data (pandas.DataFrame):
                Data to be fitted.
        """
        table_data = impute(table_data)
        self.model = multivariate.GaussianMultivariate(distribution=self.distribution)
        self.model.fit(table_data)
github HDI-Project / SDV / sdv / models / copulas.py View on Github external
in order to set expected parameters for the copula.

        Args:
            dict:
                Copula flatten parameters.
        """
        parameters = unflatten_dict(parameters)
        parameters.setdefault('fitted', True)
        parameters.setdefault('distribution', self.distribution)

        parameters = self._unflatten_gaussian_copula(parameters)
        for param in parameters['distribs'].values():
            param.setdefault('type', self.distribution)
            param.setdefault('fitted', True)

        self.model = multivariate.GaussianMultivariate.from_dict(parameters)
github HDI-Project / SDV / sdv / tabular / copulas.py View on Github external
Add additional keys after unflatte the parameters
        in order to set expected parameters for the copula.

        Args:
            dict:
                Copula flatten parameters.
            unflatten (bool):
                Whether the parameters need to be unflattened or not.
        """
        if unflatten:
            parameters = unflatten_dict(parameters)
            parameters.setdefault('distribution', self._distribution)

            parameters = self._unflatten_gaussian_copula(parameters)

        self._model = copulas.multivariate.GaussianMultivariate.from_dict(parameters)

copulas

Create tabular synthetic data using copulas-based modeling.

BSL-1.0
Latest version published 10 days ago

Package Health Score

88 / 100
Full package analysis