Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add entropy implementations. #1787

Merged
merged 2 commits into from
Apr 30, 2024
Merged

Conversation

tillahoffmann
Copy link
Contributor

This PR adds entropy implementations, using scipy.stats distributions as the reference implementation for tests where possible. There is some overlap with #1706.

Currently, only one entropy implementation is available (for the LowRankMultivariateNormal). It might be useful to switch entropy to use lazy_property as for mean and variance. That would make the interface consistent (entropy is a property of the distribution like mean or variance), and it would allow caching if the evaluation is more involved. What do you think, @fehiepsi?

Copy link
Member

@fehiepsi fehiepsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @tillahoffmann! I agree that making it a lazy property would be better. But we'll want to keep the api be consistent with pyro/pytorch distributions. If you worry about the performance, I guess we can have the lazy property _entropy. What do you think?

numpyro/distributions/continuous.py Outdated Show resolved Hide resolved
@tillahoffmann
Copy link
Contributor Author

That makes sense regarding consistency with pytorch/pyro. I've updated the betaln normalization constant.

@fehiepsi fehiepsi merged commit d6ceae1 into pyro-ppl:master Apr 30, 2024
4 checks passed
OlaRonning pushed a commit to aleatory-science/numpyro that referenced this pull request May 6, 2024
* Add entropy implementations.

* Use `betaln` to evaluate entropy of `Beta` distribution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants