Git Product home page Git Product logo

pyross's Introduction

PyRoss: Infectious disease models in Python Binder

About | Contact | Publications | News | Installation | Examples | License | Wiki

Imagel

About

PyRoss is a numerical library for mathematical modelling of infectious disease in Python. The library supports structured compartment models formulated stochastically (as chemical master equations) or deterministically (as systems of differential equations). A hybrid algorithm transits smoothly between these limits depending on the magnitude of the compartmental fluctions.

The library uses Gaussian process regression, on both the epidemiological manifold and its tangent space, to estimate model parameters given epidemiological data. These estimates are convolved with the instrinsic stochasticty of the dynamics to provide Bayesian forecasts of the progress of the epidemic.

Non-pharmaceutical interventions are implemented as controls on the contact structures of the model. Optimal control of these structures, given cost functions, is currently under development.

The library is designed to be model-agnostic. Currently implemented models are SIR, SIRS, SEIR, SEI5R, SIkR, SEkIkR, SEAIR, and SEAIRQ.

The genesis of PyRoss was to model the outbreak of the novel coronavirus COVID-19 and to assess the age-structured impact of social distancing measures in India. It can be used to study such impact for any demographic for which the age and contact structures are available.

The library is named after Sir Ronald Ross, doctor, mathematician and poet. In 1898 he made "the great discovery" in his laboratory in Calcutta "that malaria is conveyed by the bite of a mosquito". He won the Nobel Prize in 1902 and laid the foundations of the mathematical modelling of infectious diseases.

Please read the PyRoss Wiki before you use PyRoss for your research.

Contact

The authors are part of The Rapid Assistance in Modelling the Pandemic (RAMP) taskforce at the University of Cambridge. In alphabetical order, we are: Ronojoy Adhikari, Austen Bolitho, Tim Ekeh, Julian Kappler, Irene Li, Benjamin Remez and Rajesh Singh.

Please first read the wiki and then only open an issue, in preference to emailing us with queries. Issues can be shared with others with similar queries and you help the user community by communicating through issues. Thank you!

Publications

This paper is amongst the top ten most read COVID-19 papers on Research Gate . The authors have received (literally) hundreds of emails with inquiries and apologise that they can no longer respond individually to these. Please read the Frequently Asked Questions in the first instance. The authors promise to include questions not covered in the FAQ as soon as possible.

The figures below show how the lockdown forecasts from the paper are altered by a change in the epidemiological model. The SIR model provides a lower bound on the rapidity with which the epidemic decreases. All other models exceed this bound, as shown for an SEIR model. Both models are fitted to the number of infectives using case data for India till 25-03-2020.

SIR and SEIR

News

Installation

Clone (or download) the repository and use a terminal to install using

>> git clone https://github.com/rajeshrinet/pyross.git
>> cd pyross
>> python setup.py install

Pip

pip install -e git+https://github.com/rajeshrinet/pyross.git#egg=pyross

PyRoss requires the following software

Data sources

Case data: The data for COVID-19 cases is obtained from the Worldometer website.

Age structure: Population Pyramid website.

Contact structure: Projecting social contact matrices in 152 countries using contact surveys and demographic data, Kiesha Prem, Alex R. Cook, Mark Jit, PLOS Computational Biology, (2017) DOI, Supporting Information Text and Supporting Information Data.

Examples

PyRoss has a formulation-agnostic and intuitive interface. Once a model is instantiated, stochastic, deterministic and hybrid simulations can performed through the same interface. The example below shows how to set up a deterministic SIR simulation. See the examples folder for more Jupyter notebook examples.

# Ex1: M=1, SIR
import numpy as np
import pyross


M     = 1                  # the SIR model has no age structure
Ni    = 1000*np.ones(M)    # so there is only one age group
N     = np.sum(Ni)         # and the total population is the size of this age group

beta  = 0.2                # infection rate 
gIa   = 0.1                # recovery rate of asymptomatic infectives 
gIs   = 0.1                # recovery rate of symptomatic infectives 
alpha = 0                  # fraction of asymptomatic infectives 
fsa   = 1                  # the self-isolation parameter 

Ia0   = np.array([0])      # the SIR model has only one kind of infective
Is0   = np.array([1])      # we take these to be symptomatic
R0    = np.array([0])      # and assume there are no recovered individuals initially
S0    = N-(Ia0+Is0+R0)     # initial susceptibles are obtained from S + Ia + Is + R = N


# there is no contact structure
def contactMatrix(t):   
    return np.identity(M)


# instantiate model
parameters = {'alpha':alpha, 'beta':beta, 'gIa':gIa, 'gIs':gIs, 'fsa':fsa}
model      = pyross.deterministic.SIR(parameters, M, Ni)


# simulate model
Tf, Nt = 160,  160           # duration of simulation and data points
data = model.simulate(S0, Ia0, Is0, contactMatrix, Tf, Nt)

License

We believe that openness and sharing improves the practice of science and increases the reach of its benefits. This code is released under the MIT license. Our choice is guided by the excellent article on Licensing for the scientist-programmer.

pyross's People

Contributors

rajeshrinet avatar irene-li avatar juliankappler avatar ronojoy avatar tekeh avatar fcooper8472 avatar takodas avatar

Watchers

James Cloos 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.