Repository navigation
Make infection feedback a constructor option of the latent classes; remove infection_process - #906
Merged
Merged
Conversation
Collaborator
Author
|
will close #902 |
|
Thank you for your contribution @cdc-mitzimorris 🚀! Your github-pages is ready for download 👉 here 👈! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #906 +/- ##
=======================================
Coverage 98.84% 98.84%
=======================================
Files 59 58 -1
Lines 2242 2249 +7
=======================================
+ Hits 2216 2223 +7
Misses 26 26
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Oct 12, 2026
cdc-mitzimorris
changed the base branch from
main
to
mem_bugfix_903_subpop_scaling
October 13, 2026 22:22
cdc-mitzimorris
changed the base branch from
mem_bugfix_903_subpop_scaling
to
main
October 13, 2026 22:24
cdc-mitzimorris
force-pushed
the
mem_902_infection_process_redo
branch
from
October 14, 2026 22:19
739a742 to
8158533
Compare
cdc-mitzimorris
marked this pull request as ready for review
October 14, 2026 22:19
cdc-mitzimorris
requested review from
dylanhmorris and
sbidari
as code owners
October 14, 2026 22:19
Collaborator
Author
|
@dylanhmorris now ready for review |
dylanhmorris
approved these changes
Oct 19, 2026
dylanhmorris
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, thanks @cdc-mitzimorris. Apologies for the slow review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PopulationInfectionsandSubpopulationInfectionsnow compute their renewal step themselves. Infection feedback is a pair of optional constructor arguments,infection_feedback_strength_rvandinfection_feedback_pmf_rv. Theinfection_processargument and theInfectionProcessprotocol, added in #847, are removed.The legacy classes
InfectionsandInfectionsWithFeedbackare unchanged (except for one docstring cleanup to mathjax).What the user writes
Without feedback, nothing changes.
With feedback, before:
After:
SubpopulationInfectionstakes the same two arguments. Its strength can be a scalar, or have shape(n_subpops,),(n_days_post_init, 1), or(n_days_post_init, n_subpops).Renamed recorded sites
{name}::rt_single_effective{name}::rt_single_adjusted{name}::rt_subpop_effective{name}::rt_subpop_adjustedrt_singleandrt_subpop(raw Rt from the temporal processes) are unchanged. The adjusted Rt is the Rt the renewal equation uses; it equals raw Rt when feedback is off. "Adjusted" matchescompute_infections_from_rt_with_feedback, which takesRt_rawand returnsRt_adjusted.Behavior
infection_process=InfectionsWithFeedback(...)before this change. This was checked by comparing all trace sites of five configurations, three seeds each, before and after the change.ValueErrorat construction.ValueErrorat sample time. Before, this was a shape error fromjnp.einsum.ValueErrornaming both shapes.infection_processpassed:TypeErrorat construction; throughPyrenewBuilder, atbuild().sampleare unused.Changes
pyrenew/latent/base.py: private helpers_validate_feedback_optionsand_compute_renewal.pyrenew/latent/population_infections.py,subpopulation_infections.py: new constructor arguments, renewal through_compute_renewal, renamed sites, docstrings describing feedback.pyrenew/latent/infection_process.py,__init__.py:InfectionProcessremoved;InfectionProcessSamplekept for the legacy classes.InfectionsWithFeedback, zero strength, per-subpopulation strength, and each error. Factory fixtures intest/conftest.py.Breaking change
infection_process,InfectionProcess, and the_effectivesites were added in #847 and are in no tagged release.