tnoulas / UrbanEpidemicSim

5 stars 2 forks source link

added probabilistic transitions #8

Closed kpelechrinis closed 4 years ago

kpelechrinis commented 4 years ago

moved between venues according to the leave_time attribute of a person.  To do:  a. more realistic estimation of the time spent to a venue (which dictates the time to leave from a venue - currently uniformly at random between 10 to 200 minutes)b. account for the transition time between venues c. when we have a venue with no transitions generate a better process for jumping to a venue at randomd. add "places of every day life" (residence, work)e. IMPROVE run time. Currently I did not put any effort in optimizing the code - e.g., too many for loops (each epoch is ~ 13 seconds - not fixed since it depends on the movements each epoch - and covers 1 hour of "real life" simulation)

Also these are the infections for the day I simulated. Nice curve but too many infections for a day :) Most probably some (hopefully counting) bug -- or too high of infection probability. Maybe the incubation cycle might need to be changed.

Screen Shot 2020-04-09 at 9 26 02 PM
tnoulas commented 4 years ago

Hi Kostas,

I have integrated your pull request. I like in principle the idea of providing a more detailed modelling representation of a person's behaviour, but I wonder whether going in more detail here, especially through modelling and not real data is a way forward.

Firstly, the "real" 4sq transitions provided in between a pair of venues, do not capture how much time a person has stay individually but it shows which places tend to interact more with one another. Starting from place i, when we look at a transition to a place j, we kind of know now that i-j are more likely to interact than a random place k which has not been observed in the dataset. Then for a place k' that is a residence which we will synthetically add, we surely have a bias and that is when we can enable a synthetic (modelled) mobility transition.

However, I am happy to also move to a different approach eg one that we first learn probabilities of transitions between places (place matrix) and one between categories (category matrix) using the real dataset and then we build a daily movement model of what happens in the city.

And yes I started looking at a new version of incubate_cycle (see in Place.py incubate_cycle_v2) based on what we discussed on the call with Bruno, where we begin abstracting a way from specific persons, and we look at compartments (S, R, I) and interactions between those. I think if we combine those with the above place and categories matrices we can have a good starting point at an abstract level and then carefully narrow down.

Our biggest challenge will be to avoid the trap of modelling every possible detail!

tnoulas commented 4 years ago

Hi Kostas,

I have now added processing movement only at places that are infected. I have added a #NEW tag over every change to ease navigation though I understand that we don't really need this at github but anyway :).

The simulation is a faster now I think. The curve looks very similar but fewer infections.. if you go through my code and notice anything weird let me know or fix it :).

You might see some commented code here as i tried a few things that didn't really work as intended. Eg. initially I did not even do an incubation cycle at non infected places but this has the caveat of not treating properly recovering individuals. I also tried moving only infected people: https://github.com/tnoulas/UrbanEpidemicSim/blob/6c518df85182613a8df2092b361eafe00fb99f8c/PlaceNetSim_v2.py#L106 but this was even slower I think (perhaps because of the condition to check who is infected) and it did not change much in the output.

Cheers,