fix: compute FisherSnedecor pdf in log space for large freedoms - #448
Open
teddytennant wants to merge 1 commit into
Open
fix: compute FisherSnedecor pdf in log space for large freedoms#448teddytennant wants to merge 1 commit into
teddytennant wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #448 +/- ##
=======================================
Coverage 95.07% 95.07%
=======================================
Files 62 62
Lines 14191 14203 +12
=======================================
+ Hits 13492 13504 +12
Misses 699 699 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
FisherSnedecor::pdfevaluates((d1 x)^d1 * d2^d2) / (d1 x + d2)^(d1+d2)withpowf. At ordinary in-range parameters those powers overflow independently, sopdfcomes back 0 or NaN andln_pdf(which is justpdf(x).ln()) cannot recover.F(80, 80) at the mode
x = 1is a textbook density of about 1.78, not a tail.Compute
ln_pdffrom the log of the documented formula (ln_betaalready exists) and takepdf = ln_pdf.exp(). Same class of fix as the Hypergeometric / Multinomial pmfs.A few existing small-dof fixtures differ by about 1 ULP from the old product-then-sqrt path, so those tolerances moved one digit (for example
1e-16to1e-15). That is not how the overflow cases are tested; those have their own expected values.cargo test --libis green (792 passed).