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

Set initial fraction of active edges to equilibrium solution #49

Closed glwagner closed 4 years ago

glwagner commented 4 years ago

@lubo93 has pointed out that the initial fraction of active edges set, for example, here:

https://github.com/dburov190/risk-networks/blob/17835e95279ef47a76b86c07ac55655e38cc1c35/examples/generate_static_contact_networks.py#L11

should be set to the equilibrium solution

initial_fraction_active_edges = lambda / (1 / mean_contact_duration + lambda)

where lambda is the current number of mean contacts.

This means that the function outputting the mean contact rate, which is used by the ContactSimulator here:

https://github.com/dburov190/risk-networks/blob/17835e95279ef47a76b86c07ac55655e38cc1c35/epiforecast/contact_simulator.py#L73

needs to be provided during instantiation of ContactSimulator.

glwagner commented 4 years ago

Solved by this piece of instantiation:

https://github.com/dburov190/risk-networks/blob/4895444c1c393810a1c9a41f885cd68ee4cbcecd/epiforecast/contact_simulator.py#L109