Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BetaUnivariate may raise an error when fitting to data #455

Open
fealho opened this issue Jan 14, 2025 · 0 comments
Open

BetaUnivariate may raise an error when fitting to data #455

fealho opened this issue Jan 14, 2025 · 0 comments

Comments

@fealho
Copy link
Member

fealho commented Jan 14, 2025

Error Description

It's possible for the BetaUnivariate to raise an error when fitting to some data:

from copulas.univariate import BetaUnivariate
BetaUnivariate().fit(np.array([0.7122827 , 0.04830956, 0.54410219, 0.04173127, 0.54462469, 0.54565197, 0.05497849, 0.07792652, 0.6817948 , 0.19735519]))

# Fails with the following:
scipy.stats._warnings_errors.FitError: Optimization converged to parameters that are outside the range allowed by the distribution.

The error happens when fitting the univariate in the following line:

a, b, loc, scale = beta.fit(X, loc=loc, scale=scale)

Additional Context

This happens because "scipy.stats.fit doesn't guarantee success".

Note: On the rare occasion when this error happens, the synthesizers - either in Copulas or in SDV - would still work, since they have a fallback distribution for such cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant