Giter Club home page Giter Club logo

covid-discrete-stochastic-model's Introduction

COVID19 - A Discrete Stochastic Model

The aim of this project is to implement a new discrete stochastic model in order to make predictions and to estimate some metrics such as R0.

The data have been extracted from the database coronavirus.politologue. It contains information from January 24th 2020 to April 9th 2020.

Model description

Introduction

The model is a modified version of an already existing model first introduced in a paper written by Hugo Falconet and Antoine Jego.

Using a model based on Markov chains has several advantages. For example, such a model is not deterministic which allows us to take into account fluctuations regarding contamination, propagation, incubation time, etc ...

Model

Installation

Clone this repository :

git clone https://github.com/AdrienC21/covid-discrete-stochastic-model.git

Usage

Run a simulation knowing the parameters (alpha, beta, gamma) :

Edit the file simulation_parameters.py with the following information :

N = 700  # total population
delta_t = 10  # time step in seconds
alpha = 8.867883874357922e-07  # death rate
beta = 2.9340382291178016e-07  # virus spread speed
gamma = 2.6457998446967257e-07  # cure rate

Run run_simulation.py to obtain the predicted number of infected individuals.

Fit our model to obtain alpha, beta, gamma :

Edit the file optimizer_parameters.py with the following information :

N = 70  # total population
delta_t = 3600  # in seconds
# boundaries for  1 / 1000 * alpha, same for beta & gamma
bounds = tuple([(1., 5000.), (1., 5000.), (1., 5000.)])
maxiter = 50  # maximum number of iterations
# multiply our number of infected (more accurate predictions)
scale_factor = 500
country = "France"
normalize_pop = 1000000  # recommanded : real population number / N

Run run_optimizer.py to obtain alpha, beta and gamma using optimization methods.

Documentation

utils.py

extract_data

country = "France"
L = extract_data(country)

Extract the data corresponding to one country (number of infected individuals, dead people and cured ones). Sort by date.

calculate_transition_matrix

N = 700  # total population
delta_t = 10  # time step in seconds
alpha = 8.867883874357922e-07  # death rate
beta = 2.9340382291178016e-07  # virus spread speed
gamma = 2.6457998446967257e-07  # cure rate
M = calculate_transition_matrix(alpha, beta, gamma, delta_t, N)

Return the transition matrix of the model.

predict

x = np.array([alpha, beta, gamma])
prediction_array = predict(x)

Predict the number of infected people at each timestamp.

f

x = np.array([alpha, beta, gamma])
MSE = f(x)

Calculate the MSE (Mean Squared Error) between our predictions and the reality (Y). This is the function we want to minimize in order to obtain the best estimation for our parameters alpha, beta and gamma.

License

MIT

covid-discrete-stochastic-model's People

Contributors

adrienc21 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.