-
-
Notifications
You must be signed in to change notification settings - Fork 9
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 elicitation of Beta distribution with bounds and mode #309
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few files under the .idea folder that should not be part of this PR
As you can see for the Beta case, the maxent function already does something similar and in my opinion in a much more flexible way. Anyway, it may be the case that someone prefers this method. In that case, this function should have the l1, l2 and mode as input values and it should return a pz.Beta distribution with the fitted parameter and optionally plot the result. Probably the eps can be fixed as 0.005. Check pz.maxent for a reference of parameters names and other details |
Co-authored-by: Osvaldo A Martin <[email protected]>
Thanks! I made a few changes. Check The main changes are that the signature is (lower, upper, mode, mass=0.9, plot=True, plot_kwargs=None, ax=None), meaning the mode is a mandatory argument, together with the lower and upper bounds. Also, notice that it returns a frozen pz.Beta() distribution, meaning we have already passed the parameters. To compute the cdf I did a little trick. First I call pz.Beta(.,.) but then I use the |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #309 +/- ##
==========================================
- Coverage 84.19% 83.61% -0.58%
==========================================
Files 35 36 +1
Lines 4181 4218 +37
==========================================
+ Hits 3520 3527 +7
- Misses 661 691 +30 ☔ View full report in Codecov by Sentry. |
BTW, notice that we are slightly departing here from what is is presented in the paper in the sense that we are demanding the user to provide a mode and allowing them to select the mass (instead of fixing it at 0.99). Ohh another think still missing is that we should check that the mode is between lower and upper, otherwise raise an error |
Thanks for making all the changes. I'll check the maxent reference to update all the docstrings for it |
should i include an assert statement to the check the bounds of the mode? |
I have added docstrings and have tried refactoring the code to follow the standards set in the maxent function. I have also added an extra parameter eps instead of hard setting the tolerance level to 0.005. |
I'm not sure what optimisations are exactly required for the function. Also where would this module exist inside of the preliz structure? maybe somewhere in the pz.unidimentional directory and what should be the name of the module and the function one_iter exactly? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, a few more comments. Also we need to think about a name for the function
@aloctavodia thanks for all your ideas. I have tried to clean up the code by following your comments. I cannot think of a function name though the closest thing I can think of is beta_bounds_elicitation. I have added an optimisation routine let me know if that is what you were looking for. additionally, I have tried to make the plotting routine resemble the one in the maxent function however when we keep the default argument as None for the plot kwargs arg will raise an error as it expects it to be a mapping. |
A test is needed. We can add it as part of this PR, or in a different one, after merging this one. |
Make default 0.94 to be consistent library-wise
@aloctavodia I think maybe we can let the tests be a separate PR. Do you need anything else to be done as part of this PR? |
Thanks @nishant42491! |
Description
Checklist