Skip to content

Commit

Permalink
Prevent early fullsize epidemic at seed time
Browse files Browse the repository at this point in the history
  • Loading branch information
romain-ragonnet committed Jul 27, 2023
1 parent 104b08b commit a337301
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions autumn/projects/sm_covid2/common_school/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ def get_bcm_object(iso3, analysis="main"):
assert analysis in ANALYSES_NAMES, "wrong analysis name requested"

project = get_school_project(iso3, analysis)
death_target_data = project.calibration.targets[0].data

targets = [
est.NegativeBinomialTarget(
"infection_deaths",
project.calibration.targets[0].data,
dispersion_param=esp.UniformPrior("infection_deaths_dispersion_param", (10, 200))
death_target_data,
dispersion_param=esp.UniformPrior("infection_deaths_dispersion_param", (50, 200))
)
]
if len(project.calibration.targets) > 1:
Expand All @@ -68,6 +70,18 @@ def get_bcm_object(iso3, analysis="main"):
)
)

# Add a safeguard target to prevent a premature epidemic occurring before the first reported death
# Early calibrations sometimes produced a rapid epidemic reaching 100% attack rate before the true epidemic start
zero_attack_rate_series = pd.Series([0.], index=[death_target_data.index[0]])
targets.append(
est.TruncatedNormalTarget(
"prop_ever_infected",
zero_attack_rate_series,
trunc_range=[0., 0.10], # will reject runs with >10% attack rate before epidemic
stdev=1000. # flat distribution
)
)

default_configuration = project.param_set.baseline
m = project.build_model(default_configuration.to_dict())

Expand Down

0 comments on commit a337301

Please sign in to comment.