Open
Conversation
lockwo
reviewed
Apr 5, 2026
| self.rtol == 0, self.atol, self.atol + self.rtol * jnp.abs(value) | ||
| ) | ||
|
|
||
| def sample_and_log_prob(self, key: Key[Array, ""]) -> tuple[Array, Array]: |
Owner
There was a problem hiding this comment.
for these functions (that do the same as the default approach), we can use the mixin approach to inheritance (e.g. inherit from AbstractSampleLogProbDistribution as well, this can be done for multiple classes)
| import jax | ||
|
|
||
| # Must be set before any JAX arrays are initialized | ||
| jax.config.update("jax_enable_x64", True) |
Owner
There was a problem hiding this comment.
if memory serves, this can be spotty when enabled in pytest files, if you need it, we can put in a conftest.py
Owner
There was a problem hiding this comment.
I think making sure the numerics check out for non 0 values of empirical rtol/atol should have additional tests
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.
This PR adds AbstractEmpirical, Empirical and WeightedEmpirical distributions.
These distributions encapsulate a set of observed samples of a variable. The math was mirrored off tfp.distributions.Empirical with additional support for weighted samples.