-
-
Notifications
You must be signed in to change notification settings - Fork 463
Add getters for distribution parameters #1233
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
Comments
This has been discussed in the past in #560. Mainly, the concern is that we primarily care about sampling and not all distributions store their input parameters directly, and for those that do, we cannot be certain that the approach will not be changed in the future. For those that don't where parameters could be reconstructed but doing so might be lossy (limited precision) is this a good idea? This in short is why we haven't done this already, though the argument is probably too general; we should consider individual cases. For the |
Thank you for your reply! I looked for similar issues, but I missed #560 completely. I know that the main focus of the library is sampling, but the QOL improvement deriving from the implementation of getters would be significant. If you think that adding getters in case of stored (possibly swapped) parameters could be a meaningful use case, I can take care of implementing them. |
We already have getters for |
Current statusEvaluation criteria:
Summary of the evaluation criteria:
Addressed issues
Remaining issues
Since the main focus of the library is sampling, we can:
Footnotes
|
Concern: accuracy of resultMentioned in a review comment of #1234, getter result may not equal constructor parameter. Should be mentioned in docs. Slight loss of precision is not usually an issue, but we should review for possible non-finite (inf/nan) values. Concern: API lock-in of algorithmIt is potentially useful to allow internal algorithms to be changed. Such a change would already be considered a value-breaking change but not an API-breaking change. We should therefore be careful about exposing internal details (beyond minor loss of precision). More significant would be cases where parameter calculation would no longer be possible with a new algorithm, without storing extra fields. Unlikely an issue. Concern: maintenance burdenExtra work would now be required to replace algorithms in some cases due to computations for getters. These are all minor concerns and not blockers. We might consider only implementing getters in simpler cases. Thanks for the PR, Alessio Zanga. |
Sorry for the silence on this issue. I suggest we go ahead with PR #1234 with the following guidelines:
Edit: review of #1234 brought up the case where |
Closing as stale since it's not something I see as in need of solving. That said, if someone wishes to open a PR implementing some of the above, please go ahead. |
Background
What is your motivation?
Think about the
Beta
distribution fromrand_distr
. It has two parameters, namelyalpha
andbeta
, both are not public. Adding getters for distribution parameters allow to generate new distributions given previous ones, without the need to store the parameters elsewhere.What type of application is this? (E.g. cryptography, game, numerical simulation)
This feature request is a quality-of-life improvement that impact every field.
Feature request
Add getters for parameters of each distribution, similarly to the API defined in
statrs
distributions.The text was updated successfully, but these errors were encountered: