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

Dynamic and static distributional rvs #391

Merged
merged 4 commits into from
Aug 16, 2024

Conversation

dylanhmorris
Copy link
Collaborator

@dylanhmorris dylanhmorris commented Aug 16, 2024

This separates DistributionalRV into StaticDistributionalRV, in which the distribution is already instantiated (has fixed parameter values) and DynamicDistributionalRV, in which the distribution is instantiated when sample() is called with keyword arguments taken from the sample() call. The latter is designed to serve as a wrapper class for working with distributions with inferred parameters.

It also

  • Renames the dist keyword arg to DistributionalRV to distribution, to avoid clashes given the standard numpyro pattern of import numpyro.distributions as dist.
  • adds some basic tests for both subclasses

Copy link

codecov bot commented Aug 16, 2024

Codecov Report

Attention: Patch coverage is 96.77419% with 1 line in your changes missing coverage. Please review.

Project coverage is 93.09%. Comparing base (7871f9a) to head (25fa99a).
Report is 1 commits behind head on main.

Files Patch % Lines
model/src/pyrenew/metaclass.py 96.77% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #391      +/-   ##
==========================================
+ Coverage   93.01%   93.09%   +0.07%     
==========================================
  Files          39       39              
  Lines         916      941      +25     
==========================================
+ Hits          852      876      +24     
- Misses         64       65       +1     
Flag Coverage Δ
unittests 93.09% <96.77%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dylanhmorris dylanhmorris marked this pull request as ready for review August 16, 2024 20:38
Copy link
Collaborator

@damonbayer damonbayer left a comment

Choose a reason for hiding this comment

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

Really nice idea. Thanks @dylanhmorris!

@damonbayer damonbayer merged commit 9a595b2 into main Aug 16, 2024
9 checks passed
@damonbayer damonbayer deleted the dhm-dynamic-and-static-distributional-rvs branch August 16, 2024 21:48
@damonbayer damonbayer mentioned this pull request Aug 19, 2024
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.

2 participants