Repository navigation
Exact shape derivatives of the incomplete gamma's logs (#797) - #848
Merged
Merged
Conversation
The derivatives of log P and log Q in the shape were five-point differences of scipy's values: 1e-10 off mpmath's typically, up to 4e-9 (at a = 0.5, x = 1), wherever the Gamma's hazard is taken from them (a standardised time below 30; above it the hazard has its own fraction, #786). They are now carried along the series of P (below x = a + 1) and Legendre's continued fraction of Q (at or above it), in real forward mode, each to rounding: within 1e-14 of mpmath, median 3e-16. Where neither settles (a shape of millions with x near it), and at x of 0 or inf, they are differenced as before; the shape curvature a Hessian takes is the difference of the exact first derivative. Decided with the user: the cost is accepted. A GammaPH fit on 400 rows takes 0.32 s where it took 0.21 s (GammaAFT 0.17 to 0.24 s, a censored Gamma 0.04 to 0.05 s); the estimates are the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TRhKL2fJBiAAfNo9rihwts
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.
Fixes #797.
The derivatives of log P and log Q in the shape were five-point
differences of scipy's values: 1e-10 off mpmath's typically, up to 4e-9
(at a = 0.5, x = 1), wherever the Gamma's hazard is taken from them (a
standardised time below 30; above it the hazard has its own fraction,
#786). They are now carried along the series of P (below x = a + 1)
and Legendre's continued fraction of Q (at or above it), in real
forward mode, each to rounding: within 1e-14 of mpmath, median 3e-16.
Where neither settles (a shape of millions with x near it), and at x of
0 or inf, they are differenced as before; the shape curvature a Hessian
takes is the difference of the exact first derivative.
Decided with the user: the cost is accepted. A GammaPH fit on 400 rows
takes 0.32 s where it took 0.21 s (GammaAFT 0.17 to 0.24 s, a censored
Gamma 0.04 to 0.05 s); the estimates are the same.
🤖 Generated with Claude Code
https://claude.ai/code/session_01TRhKL2fJBiAAfNo9rihwts
Generated by Claude Code