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

Reworks InitializeInfectionsExponentialGrowth to work with numpyro.plate #432

Merged
merged 7 commits into from
Sep 6, 2024

Conversation

damonbayer
Copy link
Collaborator

No description provided.

scratch/plate_init_demo.py Outdated Show resolved Hide resolved
@damonbayer damonbayer marked this pull request as ready for review September 5, 2024 20:33
Copy link

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.51%. Comparing base (adf5aaf) to head (dc85fae).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #432      +/-   ##
==========================================
- Coverage   93.53%   93.51%   -0.02%     
==========================================
  Files          41       41              
  Lines        1021     1018       -3     
==========================================
- Hits          955      952       -3     
  Misses         66       66              
Flag Coverage Δ
unittests 93.51% <100.00%> (-0.02%) ⬇️

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.

@damonbayer
Copy link
Collaborator Author

damonbayer commented Sep 5, 2024

@dylanhmorris @sbidari docs are not rendering. The problem is that the shape of the output of the initialization method for a non-plated context has changed from (x,) to (x,1) (in a plated context is will be (x, n_plates)). Probably worth discussing a general plan for handling this type of change throughout PyRenew before I attempt a fix.

@dylanhmorris
Copy link
Collaborator

@dylanhmorris @sbidari docs are not rendering. The problem is that the shape of the output of the initialization method for a non-plated context has changed from (x,) to (x,1) (in a plated context is will be (x, n_plates)). Probably worth discussing a general plan for handling this type of change throughout PyRenew before I attempt a fix.

Is there a reason not to use jnp.squeeze in contexts like this?

@damonbayer
Copy link
Collaborator Author

@dylanhmorris that could be a good fix for the current demo models, but I think we need a more thorough exploration of multiple plated components working together.

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.

Given the content of the change, could we have tests both for the case in which rate is a scalar and for the case in which it is an array?

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. Tests could probably be DRY-ified via pytest.mark.parametrize but that can be a separate PR.

@dylanhmorris dylanhmorris merged commit 3c5fbe7 into main Sep 6, 2024
7 of 8 checks passed
@dylanhmorris dylanhmorris deleted the dmb_batch_input_init branch September 6, 2024 20:48
@damonbayer
Copy link
Collaborator Author

LGTM. Tests could probably be DRY-ified via pytest.mark.parametrize but that can be a separate PR.

I thought about that, but the logic to determine the manual computations seemed nearly as verbose as the fully manual solution, while being less readable.

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.

3 participants