Coder Social home page Coder Social logo

epiworldpy's Introduction

epiworldpy: Python bindings for epiworld

CI status
conda.recipe Conda Actions Status
pip builds Pip Actions Status

This is a python wrapper of the epiworld c++ library, an ABM simulation engine. This is possible using the pybind11 library (which rocks!).

The epiworld module is already implemented in R.

Installation

  • clone this repository
  • pip install ./epiworldpy

Examples

Base setup

Here we show how to create a SEIR object and add terms to it. We will use the following data:

# Loading the module
import epiworldpy as m
covid19 = m.ModelSEIR(
  name              = 'covid-19',
  n                 = 10000,
  prevalence        = .01,
  contact_rate      = 2.0,
  transmission_rate = .1,
  incubation_days   = 7.0,
  recovery_rate     = 0.14
)

We can now take a look at the model

# Creating the object
covid19.print(False)
________________________________________________________________________________
________________________________________________________________________________
SIMULATION STUDY

Name of the model   : Susceptible-Exposed-Infected-Removed (SEIR) (connected)
Population size     : 10000
Agents' data        : (none)
Number of entities  : 0
Days (duration)     : 0 (of 0)
Number of viruses   : 1
Last run elapsed t  : -
Rewiring            : off

Global actions:
 (none)

Virus(es):
 - covid-19 (baseline prevalence: 1.00%)

Tool(s):
 (none)

Model parameters:
 - Avg. Incubation days : 7.0000
 - Contact rate         : 2.0000
 - Prob. Recovery       : 0.1400
 - Prob. Transmission   : 0.1000

<epiworldpy._core.ModelSEIRCONN at 0x7fe01a91bcb0>

And run it and see what we get

covid19.run(100, 223)
covid19.print(False)
_________________________________________________________________________
Running the model...
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| done.
 done.
________________________________________________________________________________
________________________________________________________________________________
SIMULATION STUDY

Name of the model   : Susceptible-Exposed-Infected-Removed (SEIR) (connected)
Population size     : 10000
Agents' data        : (none)
Number of entities  : 0
Days (duration)     : 100 (of 100)
Number of viruses   : 1
Last run elapsed t  : 105.00ms
Last run speed      : 9.47 million agents x day / second
Rewiring            : off

Global actions:
 (none)

Virus(es):
 - covid-19 (baseline prevalence: 1.00%)

Tool(s):
 (none)

Model parameters:
 - Avg. Incubation days : 7.0000
 - Contact rate         : 2.0000
 - Prob. Recovery       : 0.1400
 - Prob. Transmission   : 0.1000

Distribution of the population at time 100:
  - (0) Susceptible :  9900 -> 8454
  - (1) Exposed     :   100 -> 140
  - (2) Infected    :     0 -> 135
  - (3) Recovered   :     0 -> 1271

Transition Probabilities:
 - Susceptible  1.00  0.00  0.00  0.00
 - Exposed      0.00  0.86  0.14  0.00
 - Infected     0.00  0.00  0.85  0.15
 - Recovered    0.00  0.00  0.00  1.00

<epiworldpy._core.ModelSEIRCONN at 0x7fe01a91bcb0>

Acknowledgements

epiworldpy's People

Contributors

gvegayon avatar

Stargazers

Dylan H. Morris avatar

Watchers

 avatar Rebecca Barter 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.