-
Notifications
You must be signed in to change notification settings - Fork 4
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
Random Draws For SEIR Parameters Per Slot #429
Open
TimothyWillard
wants to merge
10
commits into
dev
Choose a base branch
from
feature/406/random-draws-per-slot-for-SEIR
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2f93ec3
Test to demonstrate bug GH-406
TimothyWillard e39f961
Add `Parameters.reinitialize_distributions` method
TimothyWillard c828f1e
Add unit test for `reinitialize_distributions`
TimothyWillard bc0cc46
added configs to test behavior of random draws for each parameter
alsnhll 6081587
Merge dev into feature/406/random-draws-per-slot-for-SEIR
TimothyWillard 359ae85
Added tests varying multiprocessing start method
TimothyWillard baed3a7
Merge dev into feature/406/random-draws-per-slot-for-SEIR
TimothyWillard b0c3b5b
Merge dev into feature/406/random-draws-per-slot-for-SEIR
TimothyWillard 8e9aa62
Reorganize `Parameters` class unit test imports
TimothyWillard f59add3
Add `run_test_in_separate_process` utility
TimothyWillard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
132 changes: 132 additions & 0 deletions
132
examples/tutorials/config_sample_2pop_modifiers_test_random.yml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
name: sample_2pop | ||
setup_name: minimal | ||
start_date: 2020-02-01 | ||
end_date: 2020-08-31 | ||
nslots: 1 | ||
|
||
subpop_setup: | ||
geodata: model_input/geodata_sample_2pop.csv | ||
mobility: model_input/mobility_sample_2pop.csv | ||
|
||
initial_conditions: | ||
method: SetInitialConditions | ||
initial_conditions_file: model_input/ic_2pop.csv | ||
allow_missing_subpops: TRUE | ||
allow_missing_compartments: TRUE | ||
|
||
compartments: | ||
infection_stage: ["S", "E", "I", "R"] | ||
|
||
seir: | ||
integration: | ||
method: rk4 | ||
dt: 1 | ||
parameters: | ||
sigma: | ||
value: 1 / 4 | ||
gamma: | ||
value: 1 / 5 | ||
Ro: | ||
value: | ||
distribution: truncnorm | ||
mean: 2.5 | ||
sd: 0.1 | ||
a: 1.1 | ||
b: 3 | ||
transitions: | ||
- source: ["S"] | ||
destination: ["E"] | ||
rate: ["Ro * gamma"] | ||
proportional_to: [["S"],["I"]] | ||
proportion_exponent: ["1","1"] | ||
- source: ["E"] | ||
destination: ["I"] | ||
rate: ["sigma"] | ||
proportional_to: ["E"] | ||
proportion_exponent: ["1"] | ||
- source: ["I"] | ||
destination: ["R"] | ||
rate: ["gamma"] | ||
proportional_to: ["I"] | ||
proportion_exponent: ["1"] | ||
|
||
seir_modifiers: | ||
scenarios: | ||
- Ro_all | ||
modifiers: | ||
Ro_lockdown: | ||
method: SinglePeriodModifier | ||
parameter: Ro | ||
period_start_date: 2020-03-15 | ||
period_end_date: 2020-05-01 | ||
subpop: "all" | ||
value: 0.4 | ||
Ro_relax: | ||
method: SinglePeriodModifier | ||
parameter: Ro | ||
period_start_date: 2020-05-01 | ||
period_end_date: 2020-08-31 | ||
subpop: "all" | ||
value: | ||
distribution: truncnorm | ||
mean: 0.8 | ||
sd: 0.1 | ||
a: 0.5 | ||
b: 1 | ||
Ro_all: | ||
method: StackedModifier | ||
modifiers: ["Ro_lockdown","Ro_relax"] | ||
|
||
|
||
outcomes: | ||
method: delayframe | ||
outcomes: | ||
incidCase: #incidence of detected cases | ||
source: | ||
incidence: | ||
infection_stage: "I" | ||
probability: | ||
value: 0.5 | ||
delay: | ||
value: 5 | ||
incidHosp: #incidence of hospitalizations | ||
source: | ||
incidence: | ||
infection_stage: "I" | ||
probability: | ||
value: 0.05 | ||
delay: | ||
value: 7 | ||
duration: | ||
value: 10 | ||
name: currHosp # will track number of current hospitalizations (ie prevalence) | ||
incidDeath: #incidence of deaths | ||
source: incidHosp | ||
probability: | ||
value: 0.2 | ||
delay: | ||
value: | ||
distribution: truncnorm | ||
mean: 14 | ||
sd: 2 | ||
a: 7 | ||
b: 21 | ||
|
||
outcome_modifiers: | ||
scenarios: | ||
- test_limits | ||
modifiers: | ||
# assume that due to limitations in testing, initially the case detection probability was lower | ||
test_limits: | ||
method: SinglePeriodModifier | ||
parameter: incidCase::probability | ||
subpop: "all" | ||
period_start_date: 2020-02-01 | ||
period_end_date: 2020-06-01 | ||
value: | ||
distribution: truncnorm | ||
mean: 0.5 | ||
sd: 0.1 | ||
a: 0.1 | ||
b: 0.9 | ||
|
134 changes: 134 additions & 0 deletions
134
examples/tutorials/config_sample_2pop_modifiers_test_random_subpop_groups.yml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
name: sample_2pop | ||
setup_name: minimal | ||
start_date: 2020-02-01 | ||
end_date: 2020-08-31 | ||
nslots: 1 | ||
|
||
subpop_setup: | ||
geodata: model_input/geodata_sample_2pop.csv | ||
mobility: model_input/mobility_sample_2pop.csv | ||
|
||
initial_conditions: | ||
method: SetInitialConditions | ||
initial_conditions_file: model_input/ic_2pop.csv | ||
allow_missing_subpops: TRUE | ||
allow_missing_compartments: TRUE | ||
|
||
compartments: | ||
infection_stage: ["S", "E", "I", "R"] | ||
|
||
seir: | ||
integration: | ||
method: rk4 | ||
dt: 1 | ||
parameters: | ||
sigma: | ||
value: 1 / 4 | ||
gamma: | ||
value: 1 / 5 | ||
Ro: | ||
value: | ||
distribution: truncnorm | ||
mean: 2.5 | ||
sd: 0.1 | ||
a: 1.1 | ||
b: 3 | ||
transitions: | ||
- source: ["S"] | ||
destination: ["E"] | ||
rate: ["Ro * gamma"] | ||
proportional_to: [["S"],["I"]] | ||
proportion_exponent: ["1","1"] | ||
- source: ["E"] | ||
destination: ["I"] | ||
rate: ["sigma"] | ||
proportional_to: ["E"] | ||
proportion_exponent: ["1"] | ||
- source: ["I"] | ||
destination: ["R"] | ||
rate: ["gamma"] | ||
proportional_to: ["I"] | ||
proportion_exponent: ["1"] | ||
|
||
seir_modifiers: | ||
scenarios: | ||
- Ro_all | ||
modifiers: | ||
Ro_lockdown: | ||
method: SinglePeriodModifier | ||
parameter: Ro | ||
period_start_date: 2020-03-15 | ||
period_end_date: 2020-05-01 | ||
subpop: "all" | ||
value: 0.4 | ||
Ro_relax: | ||
method: SinglePeriodModifier | ||
parameter: Ro | ||
period_start_date: 2020-05-01 | ||
period_end_date: 2020-08-31 | ||
subpop: "all" | ||
subpop_groups: "all" | ||
value: | ||
distribution: truncnorm | ||
mean: 0.8 | ||
sd: 0.1 | ||
a: 0.5 | ||
b: 1 | ||
Ro_all: | ||
method: StackedModifier | ||
modifiers: ["Ro_lockdown","Ro_relax"] | ||
|
||
|
||
outcomes: | ||
method: delayframe | ||
outcomes: | ||
incidCase: #incidence of detected cases | ||
source: | ||
incidence: | ||
infection_stage: "I" | ||
probability: | ||
value: 0.5 | ||
delay: | ||
value: 5 | ||
incidHosp: #incidence of hospitalizations | ||
source: | ||
incidence: | ||
infection_stage: "I" | ||
probability: | ||
value: 0.05 | ||
delay: | ||
value: 7 | ||
duration: | ||
value: 10 | ||
name: currHosp # will track number of current hospitalizations (ie prevalence) | ||
incidDeath: #incidence of deaths | ||
source: incidHosp | ||
probability: | ||
value: 0.2 | ||
delay: | ||
value: | ||
distribution: truncnorm | ||
mean: 14 | ||
sd: 2 | ||
a: 7 | ||
b: 21 | ||
|
||
outcome_modifiers: | ||
scenarios: | ||
- test_limits | ||
modifiers: | ||
# assume that due to limitations in testing, initially the case detection probability was lower | ||
test_limits: | ||
method: SinglePeriodModifier | ||
parameter: incidCase::probability | ||
subpop: "all" | ||
subpop_groups: "all" | ||
period_start_date: 2020-02-01 | ||
period_end_date: 2020-06-01 | ||
value: | ||
distribution: truncnorm | ||
mean: 0.5 | ||
sd: 0.1 | ||
a: 0.1 | ||
b: 0.9 | ||
|
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might fix a seed in a way that is not always desirable: with classical inference, every ith iteration will have the same seed across slots. I would rely on /dev/random for now to be sure things are working correctly and keep the reproducibility of runs as a follow-up issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that suggests a fix is needed in how classical inference works - any inference method should be managing set seeding in a sensible way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fully agree. I would suggest a plan as follows:
If we do 3. before 2. there might be places that have unexpected behavior which is IMO more critical than being reproducible (even though that's also very important)