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

Change Order Of The name Argument To Match Numpyro #324

Conversation

AFg6K7h4fhy2
Copy link
Collaborator

@AFg6K7h4fhy2 AFg6K7h4fhy2 commented Jul 25, 2024

As per DHM:

name should be the first argument to the constructor of all RandomVariables, and should be mandatory.

This makes RandomVariable constructors follow the same pattern as calls to numpyro.sample(), which have the name first. This is relevant because the name attribute of a RandomVariable is used to construct site names for any numpyro.sample or numpyro.deterministic calls that occur within the RandomVariable's sample() method.

Currently, some RandomVariables have name as the first constructor argument, but others do not, and some have default values for name (which #306 should fix)

@AFg6K7h4fhy2 AFg6K7h4fhy2 self-assigned this Jul 25, 2024
@AFg6K7h4fhy2 AFg6K7h4fhy2 added clean up Good code that could be better pyrenew related to pyrenew internals labels Jul 25, 2024
@AFg6K7h4fhy2 AFg6K7h4fhy2 added this to the 🦆 Olorotitan milestone Jul 25, 2024
Copy link

codecov bot commented Jul 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (56ca6f5) to head (8dc50a7).
Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main      #324      +/-   ##
===========================================
+ Coverage   92.80%   100.00%   +7.19%     
===========================================
  Files          39         2      -37     
  Lines         904         7     -897     
===========================================
- Hits          839         7     -832     
+ Misses         65         0      -65     
Flag Coverage Δ
unittests 100.00% <ø> (+7.19%) ⬆️

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.

Copy link
Collaborator

@dylanhmorris dylanhmorris left a comment

Choose a reason for hiding this comment

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

Thanks, @AFg6K7h4fhy2! A few very minor suggestions.

model/src/pyrenew/deterministic/deterministic.py Outdated Show resolved Hide resolved
model/src/pyrenew/deterministic/deterministicpmf.py Outdated Show resolved Hide resolved
model/src/pyrenew/deterministic/deterministicpmf.py Outdated Show resolved Hide resolved
model/src/pyrenew/deterministic/deterministicpmf.py Outdated Show resolved Hide resolved
AFg6K7h4fhy2 and others added 4 commits July 25, 2024 17:46
Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>
Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>
Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>
Co-authored-by: Dylan H. Morris <dylanhmorris@users.noreply.github.com>
Copy link
Collaborator

@dylanhmorris dylanhmorris left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @AFg6K7h4fhy2

@dylanhmorris dylanhmorris merged commit 3d77967 into main Jul 25, 2024
8 checks passed
@dylanhmorris dylanhmorris deleted the 307-name-should-be-the-first-argument-to-the-constructor-of-all-randomvariables branch July 25, 2024 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clean up Good code that could be better pyrenew related to pyrenew internals
Projects
None yet
Development

Successfully merging this pull request may close these issues.

name should be the first argument to the constructor of all RandomVariables
2 participants