fix(distribution): enforce finite params in Gamma::new#333
Open
oOOo-YKS wants to merge 3 commits intostatrs-dev:masterfrom
Open
fix(distribution): enforce finite params in Gamma::new#333oOOo-YKS wants to merge 3 commits intostatrs-dev:masterfrom
oOOo-YKS wants to merge 3 commits intostatrs-dev:masterfrom
Conversation
- before:
- Gamma::new raises an error oly when both shape and rate are zero
- after:
- Add infinite checks for shape/rate parameters
- Add test cases for invalid infinite params
Closes statrs-dev#103
Refs: statrs-dev#98, statrs-dev#102
Contributor
|
This is also the approach we took for Beta in #299, I think this is the least ambiguous route forward since our API is a floating point evaluation instead of a more thorough analysis approach. Could you also,
|
1. Deprecate GammaError::ShapeAndRateInfinite variant (no longer used) 2. Update error messages to explicitly mention NaN/infinite/zero/negative values: - "Shape must be finite (not NaN, infinite, zero, or negative)" - "Rate must be finite (not NaN, infinite, zero, or negative)" 3. Remove redundant infinity checks from cdf/sf methods (validation now centralized in constructor) 4. Related to statrs-dev#103, closes statrs-dev#98
Author
|
For sure. I've finished all these three requirements and commit. |
Contributor
|
I've made one comment, but overall it looks good, thanks for the fix |
YeungOnion
approved these changes
Jun 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #103
Refs: #98, #102