CDCgov / PyRenew

Python package for multi-signal Bayesian renewal modeling with JAX and NumPyro.
https://cdcgov.github.io/PyRenew/
Apache License 2.0
14 stars 3 forks source link

Reworks `InitializeInfectionsExponentialGrowth` to work with `numpyro.plate` #432

Closed damonbayer closed 2 months ago

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

Additional details and impacted files ```diff @@ 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](https://app.codecov.io/gh/CDCgov/PyRenew/pull/432/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CDCgov) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/CDCgov/PyRenew/pull/432/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CDCgov) | `93.51% <100.00%> (-0.02%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CDCgov#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

damonbayer commented 2 months ago

@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 commented 2 months ago

@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 commented 2 months ago

@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.

damonbayer commented 2 months ago

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.