tapios / risk-networks

Code for risk networks: a blend of compartmental models, graphs, data assimilation and semi-supervised learning
Other
2 stars 2 forks source link

NYC example with SD intervention and modified contact simulator #65

Closed lubo93 closed 4 years ago

lubo93 commented 4 years ago

This PR adds to the previous NYC example and makes the following changes:

ToDos: Simulations on larger networks.

First results on a 1,000 node network:

new_york_cases

glwagner commented 4 years ago

Since the overleaf doc may change in the future, can you write what changes were made to the diurnal modulation functions here?

lubo93 commented 4 years ago

The functions "cos4_diurnal_modulation" and "cos2_diurnal_modulation" are now based on the following structure: np.maximum(np.minimum(cmin_i, cmin_j), np.minimum(cmax_i, cmax_j) .... )

glwagner commented 4 years ago

Ah yes, I see that the new function is contact-specific

image

@lubo93 does it make sense to keep the non-specific version for this PR? I don't think we can simulate contact-specific modulations, even if we have this small function available. What do you think?

glwagner commented 4 years ago

@lubo93 it looks like we don't need new code for this function either. Am I correct that simply defining

minimum = min(λj_min, λi_min)

and

maximum = min(λj_max, λi_max)

plus a new parameter normalization (or something) produces the same function as before?

lubo93 commented 4 years ago

We could still use the previous \lambda_ji in another function (to model a "global contact rate"). For future code versions, it would be good if we also start transitioning towards node-specific lambdas. We need arrays of \lambdas for our intervention simulations.

glwagner commented 4 years ago

@lubo93 that's fine --- except that we dont need arrays of lambdas. As far as I can tell, we can use a list of DiurnalMeanContactRate instead. Won't this work?

lubo93 commented 4 years ago

@lubo93 it looks like we don't need new code for this function either. Am I correct that simply defining

minimum = min(λj_min, λi_min)

and

maximum = min(λj_max, λi_max)

plus a new parameter normalization (or something) produces the same function as before?

Yes, right. We could also keep the old version and define a maximum and minimum function.

glwagner commented 4 years ago

Hmm, ok, maybe I don't completely understand what is needed. It looks to me like this function has exactly the same mathematical form as the previous object; it is simply that we are going to need n_contacts instances of DiurnalMeanContactRate, rather than just 1 as we are currently using.

lubo93 commented 4 years ago

@lubo93 that's fine --- except that we dont need arrays of lambdas. As far as I can tell, we can use a list of DiurnalMeanContactRate instead. Won't this work?

This would be something for the meeting tomorrow. It depends on how we want to model interventions. One way would be to reduce lambda_min and lambda_max of a specific node.

lubo93 commented 4 years ago

Hmm, ok, maybe I don't completely understand what is needed. It looks to me like this function has exactly the same mathematical form as the previous object; it is simply that we are going to need n_contacts instances of DiurnalMeanContactRate, rather than just 1 as we are currently using.

Agree with you. This would work.

glwagner commented 4 years ago

This would be something for the meeting tomorrow. It depends on how we want to model interventions. One way would be to reduce lambda_min and lambda_max of a specific node.

Okay, I see. In that case, we'd have to re-instantiate the DiurnalMeanContactRate that are connected to a self-isolating node, and recompute its parameters. Using the other abstraction, we only need to change one number in an array.

tapios commented 4 years ago

This would be something for the meeting tomorrow. It depends on how we want to model interventions. One way would be to reduce lambda_min and lambda_max of a specific node.

Okay, I see. In that case, we'd have to re-instantiate the DiurnalMeanContactRate that are connected to a self-isolating node, and recompute its parameters. Using the other abstraction, we only need to change one number in an array.

Yes, we need that capability to model individual-level interventions.