Skip to content

Commit

Permalink
Fixed +-inf error in date of interventions (hopefully)
Browse files Browse the repository at this point in the history
  • Loading branch information
semohr committed Mar 3, 2021
1 parent 3c5437b commit 6bdc1ab
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions covid19_npis/model/reproduction_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,13 @@ def date():
modelParams.date_data_tensor
) # shape intervention, country, change_points

return d_data + delta_d_i + delta_d_c
d_return = d_data + delta_d_i + delta_d_c
# Clip by value should be in range of our simulation
d_return = d_return.clip_by_value(
-modelParams.length_sim, modelParams.length_sim
)

return d_return

d_i_c_p = yield Deterministic(
name="d_i_c_p",
Expand Down Expand Up @@ -527,7 +533,7 @@ def construct_R_0(name, modelParams, loc, scale, hn_scale):
log.debug(f"R_0_c:\n{R_0_c}")

# for robustness
tf.clip_by_value(R_0_c, 1, 5)
R_0_c = tf.clip_by_value(R_0_c, 1, 5)

return tf.repeat(
R_0_c[..., tf.newaxis], repeats=modelParams.num_age_groups, axis=-1
Expand Down

0 comments on commit 6bdc1ab

Please sign in to comment.