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 log1mexp and logdiffexp functions #1960

Merged
merged 15 commits into from
Jan 26, 2025

Conversation

dylanhmorris
Copy link
Contributor

@dylanhmorris dylanhmorris commented Jan 26, 2025

Summary

Adds numerically stable implementations of log1mexp and logdiffexp, following Machler 2012. Provides a custom jvp for log1mexp to increase numerical stability near 0.

Closes #1368

Changes

  • Adds functions and updates documentation to include them.
  • Adds tests for the functions.

Testing / documentation.

  • Verified test_distributions_util.py passes locally, including new tests.
  • Confirmed documentation renders locally and that new docs render as expected.

Code cleanliness and style

pre-commit and linting / styling pass locally.

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.

Looks awesome! I think we can go ahead and use those utilities in several current distributions.

@fehiepsi fehiepsi merged commit 93e11c2 into pyro-ppl:master Jan 26, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

log1m_exp and log_diff_exp functions
2 participants