Repository navigation
Evaluate unit-concentration Gamma densities correctly at zero - #361
Open
sylvesterkaczmarek wants to merge 1 commit into
Open
sylvesterkaczmarek wants to merge 1 commit into
sylvesterkaczmarek wants to merge 1 commit into
Conversation
Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
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.
Summary
Fixes #360.
Use
jax.scipy.special.xlogyfor the concentration-offset times log(value) term. This evaluates the zero-coefficient case correctly at value zero instead of forming 0 * -inf. Unit-concentration Gamma densities now match their exponential special case, including throughprobandIndependentproducts. No CDF or sampling code is changed.Validation
python -m pytest -q distrax/_src/distributions/gamma_test.py distrax/_src/distributions/gamma_boundary_test.py181 tests and 156 subtests passed; 30 existing variants were skipped. Fourteen new tests include analytic exponential densities, SciPy boundary limits, float32/float64, broadcast concentrations/rates, JIT, an Independent product, rate derivatives and positive-value derivative controls. Ten new cases fail on unchanged upstream and four controls pass.
The existing Gamma equivalence tests also pass; they emitted upstream TensorFlow Probability/JAX deprecation warnings. This patch does not introduce support validation or define observation derivatives at the boundary. GPU/TPU and the full Distrax suite were not run.
New-test formatting, Python syntax checks, scoped static checks and
git diff --checkpass. No dependency or workflow changes.