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

update infectionswithfeedback process #440

Conversation

sbidari
Copy link
Collaborator

@sbidari sbidari commented Sep 10, 2024

This PR modifies the following functions/files such that these now work when I0 and Rt are 2D arrays as is the case for site-level hierarchical model.

  • convolve.py : new_convolve_scanner and new_double_convolve_scanner
  • arrayutils.py : added a function pad_edges_to_match that pads multidimensional arrays using speficied edge values
  • Infections and InfectionWithFeedback classes in latent module
  • add tests of these functions using 2D arrays where appropriate
  • add more tests for convolve scanner functions (Additional tests for convolve scanner factory functions #189)
  • add additional tests for Infection and InfectionWithFeedback classes

Out of scope

  • multidimensional generational intervals

…-handle-batch-input-within-numpyro-plate-context
Copy link

codecov bot commented Sep 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.26%. Comparing base (ade84ce) to head (bafe3b0).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #440      +/-   ##
==========================================
+ Coverage   94.03%   94.26%   +0.23%     
==========================================
  Files          42       42              
  Lines         989      994       +5     
==========================================
+ Hits          930      937       +7     
+ Misses         59       57       -2     
Flag Coverage Δ
unittests 94.26% <100.00%> (+0.23%) ⬆️

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.

@sbidari sbidari marked this pull request as ready for review September 11, 2024 20:49
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.

Looks nice @sbidari, but I think there are some opportunities to improve performance and clarity.

@damonbayer
Copy link
Collaborator

damonbayer commented Sep 11, 2024

@sbidari Can you also look into addressing #394 and #189 in this PR?

@sbidari
Copy link
Collaborator Author

sbidari commented Sep 12, 2024

@sbidari Can you also look into addressing #394 and #189 in this PR?

Added more tests for the convolve factory functions in d933df4

@damonbayer
Copy link
Collaborator

@sbidari Can we also have tests that try to use numpyro.plate and make sure things work as expected?

…-handle-batch-input-within-numpyro-plate-context
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.

A few open questions. I would also like @dylanhmorris to take a look, if he can, since he just did similar work on the AR class.

…ch-input-within-numpyro-plate-context' of https://github.com/CDCgov/PyRenew into 435-update-infectionswithfeedback-process-to-handle-batch-input-within-numpyro-plate-context
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.

This looks generally very good, thanks @sbidari. A few questions about scope on which I will defer to you and @damonbayer, and a suggestion about dot products that will be useful for future-proofing.

docs/source/tutorials/extending_pyrenew.qmd Outdated Show resolved Hide resolved
docs/source/tutorials/extending_pyrenew.qmd Outdated Show resolved Hide resolved
pyrenew/convolve.py Show resolved Hide resolved
pyrenew/convolve.py Outdated Show resolved Hide resolved
pyrenew/convolve.py Outdated Show resolved Hide resolved
pyrenew/latent/infectionswithfeedback.py Show resolved Hide resolved
test/test_arrayutils.py Show resolved Hide resolved
test/test_arrayutils.py Show resolved Hide resolved
test/test_convolve_scanners.py Outdated Show resolved Hide resolved
test/test_convolve_scanners.py Outdated Show resolved Hide resolved
@sbidari
Copy link
Collaborator Author

sbidari commented Sep 13, 2024

Thanks @dylanhmorris
I think multidimensional gen_int is out of scope for this PR (I will make a note in the PR description) and this is ready for final review.

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.

A key remaining question about the dimensionality check

pyrenew/convolve.py Outdated Show resolved Hide resolved
pyrenew/latent/infections.py Outdated Show resolved Hide resolved
pyrenew/latent/infectionswithfeedback.py Outdated Show resolved Hide resolved
pyrenew/latent/infections.py Outdated Show resolved Hide resolved
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.

One final thing @sbidari, otherwise looks ready!

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

@dylanhmorris
Copy link
Collaborator

@damonbayer can you confirm your concerns were resolved?

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.

Thanks @sbidari!

@damonbayer damonbayer merged commit ab8238a into main Sep 17, 2024
8 checks passed
@damonbayer damonbayer deleted the 435-update-infectionswithfeedback-process-to-handle-batch-input-within-numpyro-plate-context branch September 17, 2024 20:41
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.

Update InfectionsWithFeedback process to handle batch input within numpyro plate context
3 participants