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

Add mode method for DiscreteWeibull, LogitNormal, Hypergeometric and SkewNormal #636

Merged
merged 12 commits into from
Feb 17, 2025

Conversation

Advaitgaur004
Copy link
Contributor

@Advaitgaur004 Advaitgaur004 commented Jan 23, 2025

Description

This PR targeted #604 and work is in progress.

Implemented Modes

  • Discreteweibull
  • logitnormal
  • hypergeometric
  • SkewNormal

@Advaitgaur004
Copy link
Contributor Author

  • Binomial Distribution:
    Becomes bimodal when n is large and p is 0.5
  • Beta Distribution:
    Becomes bimodal when both shape parameters (α and β) are less than 1
  • Mixture Distribution:
    Explicitly created by combining two Gaussian distributions
  • Beta-Binomial Distribution:
    Bimodality occurs with small α and β parameters

@rohanbabbar04 These need to be changed if we are opting to send a tuple for multimodal purposes.

@Advaitgaur004
Copy link
Contributor Author

@aloctavodia Issues have been updated for discrete_weibull; I will use minimize_scale from scipy.optimize since direct calculation for mode in discrete_weibull isn't feasible. For the rest, the mode is calculated as provided in Wikipedia or some reliable sources.

preliz/distributions/discrete_weibull.py Show resolved Hide resolved
preliz/distributions/exgaussian.py Outdated Show resolved Hide resolved
preliz/distributions/exgaussian.py Outdated Show resolved Hide resolved
preliz/distributions/logitnormal.py Show resolved Hide resolved
preliz/distributions/skew_studentt.py Outdated Show resolved Hide resolved
preliz/distributions/skewnormal.py Outdated Show resolved Hide resolved
@aloctavodia
Copy link
Contributor

@Advaitgaur004 are you still working on this?

@Advaitgaur004
Copy link
Contributor Author

@Advaitgaur004 are you still working on this?

Yes, i am busy for 2 more days, i'll made pr in some time

@aloctavodia
Copy link
Contributor

great! Thanks

@Advaitgaur004
Copy link
Contributor Author

Changes Made in

Discreteweibull
Exgaussian
logitnormal
hypergeometric
SkewNormal

preliz/internal/optimization.py Outdated Show resolved Hide resolved
preliz/internal/optimization.py Outdated Show resolved Hide resolved
preliz/distributions/exgaussian.py Outdated Show resolved Hide resolved
preliz/distributions/logitnormal.py Show resolved Hide resolved
preliz/distributions/logitnormal.py Outdated Show resolved Hide resolved
preliz/distributions/skew_studentt.py Outdated Show resolved Hide resolved
preliz/distributions/continuous_multivariate.py Outdated Show resolved Hide resolved
preliz/distributions/studentt.py Outdated Show resolved Hide resolved
This reverts commit 8d2d0c0.
This reverts commit 06b20fc.
@aloctavodia aloctavodia changed the title Add mode method to more distribution classes Add mode method for DiscreteWeibull, LogitNormal, Hypergeometric and SkewNormal Feb 17, 2025
@aloctavodia
Copy link
Contributor

@Advaitgaur004 check the tests that are failing, you will see linter errors.

@Advaitgaur004
Copy link
Contributor Author

@Advaitgaur004 check the tests that are failing, you will see linter errors.

I've finished reviewing the files. Now I see the issue with those three files; I didn't apply the black style, which caused the problem. I have now updated all the files accordingly, and there are no linter errors.

@aloctavodia aloctavodia merged commit d8c1c7a into arviz-devs:main Feb 17, 2025
1 of 4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants