All Projects → covid19-modeling → Pyncov 19

covid19-modeling / Pyncov 19

Licence: mit
Pyncov-19: Learn and predict the spread of COVID-19

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pyncov 19

photontorch
Highly parallel simulation and optimization of photonic circuits in time and frequency domain based on the deep-learning framework PyTorch
Stars: ✭ 29 (+45%)
Mutual labels:  simulator, simulation
Pytorch Cortexnet
PyTorch implementation of the CortexNet predictive model
Stars: ✭ 349 (+1645%)
Mutual labels:  jupyter-notebook, predictive-modeling
rcssserver
The RoboCup Soccer Simulator Server
Stars: ✭ 100 (+400%)
Mutual labels:  simulator, simulation
opem
OPEM (Open Source PEM Fuel Cell Simulation Tool)
Stars: ✭ 107 (+435%)
Mutual labels:  simulator, simulation
Space Nerds In Space
Multi-player spaceship bridge simulator. Captain your starship through adventures with your friends. See https://smcameron.github.io/space-nerds-in-space
Stars: ✭ 516 (+2480%)
Mutual labels:  simulator, simulation
pluto-gps-sim
PLUTO-GPS-SIM generates a GPS baseband signal IQ data stream, which is then transmitted by the software-defined radio (SDR) platform ADALM-Pluto.
Stars: ✭ 74 (+270%)
Mutual labels:  simulator, simulation
Islr Python
An Introduction to Statistical Learning (James, Witten, Hastie, Tibshirani, 2013): Python code
Stars: ✭ 3,344 (+16620%)
Mutual labels:  jupyter-notebook, predictive-modeling
Pyro2
A framework for hydrodynamics explorations and prototyping
Stars: ✭ 181 (+805%)
Mutual labels:  jupyter-notebook, simulation
Boolr
A digital logic simulator
Stars: ✭ 445 (+2125%)
Mutual labels:  simulator, simulation
Gazebo
Open source robotics simulator.
Stars: ✭ 404 (+1920%)
Mutual labels:  simulator, simulation
ad-xolib
C++ library for Parsing OpenScenario (1.1.1) & OpenDrive files (1.7) ASAM Specifications
Stars: ✭ 56 (+180%)
Mutual labels:  simulator, simulation
Coursera Machine Learning
Coursera Machine Learning - Python code
Stars: ✭ 815 (+3975%)
Mutual labels:  jupyter-notebook, predictive-modeling
Smt
Surrogate Modeling Toolbox
Stars: ✭ 233 (+1065%)
Mutual labels:  jupyter-notebook, predictive-modeling
antares
Digital circuit learning platform
Stars: ✭ 15 (-25%)
Mutual labels:  simulator, simulation
Tcdf
Temporal Causal Discovery Framework (PyTorch): discovering causal relationships between time series
Stars: ✭ 217 (+985%)
Mutual labels:  jupyter-notebook, forecasting
Facet
Human-explainable AI.
Stars: ✭ 269 (+1245%)
Mutual labels:  jupyter-notebook, simulation
Covid19 Severity Prediction
Extensive and accessible COVID-19 data + forecasting for counties and hospitals. 📈
Stars: ✭ 170 (+750%)
Mutual labels:  jupyter-notebook, forecasting
Introduction To Time Series Forecasting Python
Introduction to time series preprocessing and forecasting in Python using AR, MA, ARMA, ARIMA, SARIMA and Prophet model with forecast evaluation.
Stars: ✭ 173 (+765%)
Mutual labels:  jupyter-notebook, forecasting
Hexapod
Blazing fast hexapod robot simulator for the web.
Stars: ✭ 370 (+1750%)
Mutual labels:  simulator, simulation
Stockpriceprediction
Stock Price Prediction using Machine Learning Techniques
Stars: ✭ 700 (+3400%)
Mutual labels:  jupyter-notebook, forecasting

Pyncov-19: Learn and predict the spread of COVID-19

Open In Colab

Pyncov-19 is a tiny probabilistic simulator for SARS-CoV-2 implemented in Python 3, whose only dependency is Numpy 1.18. This simulator is used to learn and predict the temporal dynamics of COVID-19 that are shown in https://covid19-modeling.github.io. It implements a probabilistic compartmental model at the individual level using a Markov Chain model with temporal transitions that were adjusted using the most recent scientific evidence.

Quick Start

Basic installation using pip with minimal dependencies:

pip install pyncov

In order to install pyncov with the additional features (progress bar, plotting) use:

pip install pyncov[all]

Sampling 100 simulated trajectories of the SARS-CoV-2 spread in Madrid:

import pyncov as nc
import pyncov.io
# Requires pandas
import pyncov.plot

susceptible = 6680000
infected = 1
num_days = 80

infection_rates = nc.infection_rates(nc.io.get_trained_params('ESP-MD'), num_days=60)
# Instantiate the model with the default parameters and sample 100 chains
# NOTE: show_progress requires the TQDM library not installed by default.
m = nc.build_markovchain(nc.MARKOV_DEFAULT_PARAMS)
simulations = nc.sample_chains(susceptible, infected, m, infection_rates, 
                               num_chains=100, show_progress=True)

You can visualizate the trajectories and the average trajectory matching the observed values in Madrid using pyncov.plot:

import matplotlib.pyplot as plt

# Load the dataset with pandas
df = pd.read_csv(...)

fig, ax = plt.subplots(1, 3, figsize=(16, 4))
nc.plot.plot_state(simulations, nc.S.I1, ax=ax[0], index=df.index, title="New infections over time")
nc.plot.plot_state(simulations, nc.S.M0, diff=True, ax=ax[1], index=df.index, title="Daily fatalities")
nc.plot.plot_state(simulations, nc.S.M0, ax=ax[2], index=df.index, title="Total fatalities")
df.diff().plot(ax=ax[1]);
df.plot(ax=ax[2]);

A more detailed explanation can be found in the notebook included in the repository https://github.com/covid19-modeling/pyncov-19/blob/master/notebooks/basics.ipynb

About

This library is still a proof-of-concept and it's inteded only to be used for research and experimentation. For more information please read our preprint:

Matabuena, M., Meijide-García, C., Rodríguez-Mier, P., & Leborán, V. (2020). COVID-19: Estimating spread in Spain solving an inverse problem with a probabilistic model. arXiv preprint arXiv:2004.13695.

This model's main goal is to estimate the levels of infections (or the seroprevalence) of the population, using only data from the registered deaths caused by COVID-19. Although the model can be used to make future predictions (evolution of infections, fatalities, etc.), that's not the primary purpose of the model. Given the uncertainty about essential events that alter the course and dynamics of the spread (for example, the use of masks, lockdowns, social distance, etc.), it is tough to make accurate predictions, so we limit ourselves to use the model to reveal more information about what happened before (backcasting).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].