def from_dict(cls, copula_dict): """Create a new instance from a parameters dictionary. Args: params (dict): Parameters of the distribution, in the same format as the one returned by the ``to_dict`` method. Returns: Multivariate: Instance of the distribution defined on the parameters. """ instance = cls() instance.univariates = [] instance.columns = copula_dict['columns'] for parameters in copula_dict['univariates']: instance.univariates.append(Univariate.from_dict(parameters)) instance.covariance = np.array(copula_dict['covariance']) instance.fitted = True warnings.warn('`covariance` will be renamed to `correlation` in v0.4.0', DeprecationWarning) return instance
def from_dict(cls, copula_dict): """Set attributes with provided values.""" instance = cls() instance.univariates = [] instance.columns = copula_dict['columns'] for parameters in copula_dict['univariates']: instance.univariates.append(Univariate.from_dict(parameters)) instance.covariance = np.array(copula_dict['covariance']) instance.fitted = copula_dict['fitted'] instance.distribution = copula_dict['distribution'] if isinstance(instance.distribution, dict): for k, v in instance.distribution.items(): instance.distribution[k] = Univariate.from_dict(v) return instance
def from_dict(cls, copula_dict): """Set attributes with provided values.""" instance = cls() instance.distribs = {} for name, parameters in copula_dict['distribs'].items(): instance.distribs[name] = Univariate.from_dict(parameters) instance.covariance = np.array(copula_dict['covariance']) instance.fitted = copula_dict['fitted'] instance.distribution = copula_dict['distribution'] return instance