Summer: compartmental disease modelling in Python

Overview

Summer: compartmental disease modelling in Python

Automated Tests

Summer is a Python-based framework for the creation and execution of compartmental (or "state-based") epidemiological models of infectious disease transmission.

It provides a range of structures for easily implementing compartmental models, including structure for some of the most common features added to basic compartmental frameworks, including:

  • A variety of inter-compartmental flows (infections, transitions, births, deaths, imports)
  • Force of infection multipliers (frequency, density)
  • Post-processing of compartment sizes into derived outputs
  • Stratification of compartments, including:
    • Adjustments to flow rates based on strata
    • Adjustments to infectiousness based on strata
    • Heterogeneous mixing between strata
    • Multiple disease strains

Some helpful links to learn more:

Installation and Quickstart

This project is tested with Python 3.6. Install the summerepi package from PyPI

pip install summerepi

Then you can use the library to build and run models. See here for some code examples.

Development

Poetry is used for packaging and dependency management.

Initial project setup is documented here and should work for Windows or Ubuntu, maybe for MacOS.

Some common things to do as a developer working on this codebase:

# Activate summer conda environment prior to doing other stuff (see setup docs)
conda activate summer

# Install latest requirements
poetry install

# Publish to PyPI - use your PyPI credentials
poetry publish --build

# Add a new package
poetry add

# Run tests
pytest -vv

# Format Python code
black .
isort . --profile black

Releases

Releases are numbered using Semantic Versioning

  • 1.0.0/1:
    • Initial release
  • 1.1.0:
    • Add stochastic integrator
  • 2.0.2:
    • Rename fractional flow to transition flow
    • Remove sojourn flow
    • Add vectorized backend and other performance improvements
  • 2.0.3:
    • Set default IVP solver to use a maximum step size of 1 timestep
  • 2.0.4:
    • Add runtime derived values
  • 2.0.5:
    • Remove legacy Summer implementation
  • 2.1.0:
    • Add AdjustmentSystems
    • Improve vectorization of flows
    • Add computed_values inputs to flow and adjustment parameters
  • 2.1.1:
    • Fix for invalid/unused package imports (cachetools)
  • 2.2.0
    • Add validation and compartment caching optimizations
  • 2.2.1
    • Derived output index caching
    • Optimized fast-tracks for infectious multipliers
  • 2.2.2
    • JIT infectiousness calculations
    • Various micro-optimizations
  • 2.2.3
    • Bugfix release (clamp outputs to 0.0)
  • 2.2.4
    • Datetime awareness, DataFrame outputs

Release process

To do a release:

  • Commit any code changes and push them to GitHub
  • Choose a new release number accoridng to Semantic Versioning
  • Add a release note above
  • Edit the version key in pyproject.toml to reflect the release number
  • Publish the package to PyPI using Poetry, you will need a PyPI login and access to the project
  • Commit the release changes and push them to GitHub (Use a commit message like "Release 1.1.0")
  • Update requirements.txt in Autumn to use the new version of Summer
poetry build
poetry publish

Documentation

Sphinx is used to automatically build reference documentation for this library. The documentation is automatically built and deployed to summerepi.com whenever code is pushed to master.

To run or edit the code examples in the documentation, start a jupyter notebook server as follows:

jupyter notebook --config docs/jupyter_notebook_config.py
# Go to http://localhost:8888/tree/docs/examples in your web browser.

You can clean outputs from all the example notbooks with

./docs/scripts/clean.sh

To build and deploy

./docs/scripts/build.sh
./docs/scripts/deploy.sh

To work on docs locally

./docs/scripts/watch.sh
You might also like...
Metric learning algorithms in Python

metric-learn: Metric Learning in Python metric-learn contains efficient Python implementations of several popular supervised and weakly-supervised met

[HELP REQUESTED] Generalized Additive Models in Python
[HELP REQUESTED] Generalized Additive Models in Python

pyGAM Generalized Additive Models in Python. Documentation Official pyGAM Documentation: Read the Docs Building interpretable models with Generalized

Karate Club: An API Oriented Open-source Python Framework for Unsupervised Learning on Graphs (CIKM 2020)
Karate Club: An API Oriented Open-source Python Framework for Unsupervised Learning on Graphs (CIKM 2020)

Karate Club is an unsupervised machine learning extension library for NetworkX. Please look at the Documentation, relevant Paper, Promo Video, and Ext

Open source time series library for Python

PyFlux PyFlux is an open source time series library for Python. The library has a good array of modern time series models, as well as a flexible array

A Python Automated Machine Learning tool that optimizes machine learning pipelines using genetic programming.
A Python Automated Machine Learning tool that optimizes machine learning pipelines using genetic programming.

Master status: Development status: Package information: TPOT stands for Tree-based Pipeline Optimization Tool. Consider TPOT your Data Science Assista

MLBox is a powerful Automated Machine Learning python library.
MLBox is a powerful Automated Machine Learning python library.

MLBox is a powerful Automated Machine Learning python library. It provides the following features: Fast reading and distributed data preprocessing/cle

Python package for stacking (machine learning technique)
Python package for stacking (machine learning technique)

vecstack Python package for stacking (stacked generalization) featuring lightweight functional API and fully compatible scikit-learn API Convenient wa

A Python Package to Tackle the Curse of Imbalanced Datasets in Machine Learning

imbalanced-learn imbalanced-learn is a python package offering a number of re-sampling techniques commonly used in datasets showing strong between-cla

Python-based implementations of algorithms for learning on imbalanced data.

ND DIAL: Imbalanced Algorithms Minimalist Python-based implementations of algorithms for imbalanced learning. Includes deep and representational learn

Comments
  • Vectorized backend and support code

    Vectorized backend and support code

    This is the fast vectorized backend we've been discussing lately. It runs our covid model ~3x faster than the reference.

    Wanting to get this merged sooner rather than later to avoid code drift. Matt has looked at this already, feedback from James appreciated

    opened by dshipman 0
Releases(v1.0.1)
Official code for HH-VAEM

HH-VAEM This repository contains the official Pytorch implementation of the Hierarchical Hamiltonian VAE for Mixed-type Data (HH-VAEM) model and the s

Ignacio Peis 8 Nov 30, 2022
Repository for DCA0305, an undergraduate course about Machine Learning Workflows and Pipelines

Federal University of Rio Grande do Norte Technology Center Department of Computer Engineering and Automation Machine Learning Based Systems Design Re

Ivanovitch Silva 81 Oct 18, 2022
Decision Tree Regression algorithm implemented on Python from scratch.

Decision_Tree_Regression I implemented the decision tree regression algorithm on Python. Unlike regular linear regression, this algorithm is used when

1 Dec 22, 2021
Kalman filter library

The kalman filter framework described here is an incredibly powerful tool for any optimization problem, but particularly for visual odometry, sensor fusion localization or SLAM.

comma.ai 276 Jan 01, 2023
machine learning model deployment project of Iris classification model in a minimal UI using flask web framework and deployed it in Azure cloud using Azure app service

This is a machine learning model deployment project of Iris classification model in a minimal UI using flask web framework and deployed it in Azure cloud using Azure app service. We initially made th

Krishna Priyatham Potluri 73 Dec 01, 2022
Hypernets: A General Automated Machine Learning framework to simplify the development of End-to-end AutoML toolkits in specific domains.

A General Automated Machine Learning framework to simplify the development of End-to-end AutoML toolkits in specific domains.

DataCanvas 216 Dec 23, 2022
Apache (Py)Spark type annotations (stub files).

PySpark Stubs A collection of the Apache Spark stub files. These files were generated by stubgen and manually edited to include accurate type hints. T

Maciej 114 Nov 22, 2022
Anytime Learning At Macroscale

On Anytime Learning At Macroscale Learning from sequential data dumps (key) Requirements Python 3.7 Pytorch 1.9.0 Hydra 1.1.0 (pip install hydra-core

Meta Research 8 Mar 29, 2022
Simple, fast, and parallelized symbolic regression in Python/Julia via regularized evolution and simulated annealing

Parallelized symbolic regression built on Julia, and interfaced by Python. Uses regularized evolution, simulated annealing, and gradient-free optimization.

Miles Cranmer 924 Jan 03, 2023
GRaNDPapA: Generator of Rad Names from Decent Paper Acronyms

Generator of Rad Names from Decent Paper Acronyms

264 Nov 08, 2022
Nevergrad - A gradient-free optimization platform

Nevergrad - A gradient-free optimization platform nevergrad is a Python 3.6+ library. It can be installed with: pip install nevergrad More installati

Meta Research 3.4k Jan 08, 2023
ETNA – time series forecasting framework

ETNA Time Series Library Predict your time series the easiest way Homepage | Documentation | Tutorials | Contribution Guide | Release Notes ETNA is an

Tinkoff.AI 675 Jan 08, 2023
Automated Machine Learning with scikit-learn

auto-sklearn auto-sklearn is an automated machine learning toolkit and a drop-in replacement for a scikit-learn estimator. Find the documentation here

AutoML-Freiburg-Hannover 6.7k Jan 07, 2023
Pandas DataFrames and Series as Interactive Tables in Jupyter

Pandas DataFrames and Series as Interactive Tables in Jupyter Star Turn pandas DataFrames and Series into interactive datatables in both your notebook

Marc Wouts 364 Jan 04, 2023
Kaggler is a Python package for lightweight online machine learning algorithms and utility functions for ETL and data analysis.

Kaggler is a Python package for lightweight online machine learning algorithms and utility functions for ETL and data analysis. It is distributed under the MIT License.

Jeong-Yoon Lee 720 Dec 25, 2022
Predicting India’s COVID-19 Third Wave with LSTM

Predicting India’s COVID-19 Third Wave with LSTM Complete project of predicting new COVID-19 cases in the next 90 days with LSTM India is seeing a ste

Samrat Dutta 4 Jan 27, 2022
Apple-voice-recognition - Machine Learning

Apple-voice-recognition Machine Learning How does Siri work? Siri is based on large-scale Machine Learning systems that employ many aspects of data sc

Harshith VH 1 Oct 22, 2021
Time-series momentum for momentum investing strategy

Time-series-momentum Time-series momentum strategy. You can use the data_analysis.py file to find out the best trigger and window for a given asset an

Victor Caldeira 3 Jun 18, 2022
A Python Automated Machine Learning tool that optimizes machine learning pipelines using genetic programming.

Master status: Development status: Package information: TPOT stands for Tree-based Pipeline Optimization Tool. Consider TPOT your Data Science Assista

Epistasis Lab at UPenn 8.9k Jan 09, 2023
Learn Machine Learning Algorithms by doing projects in Python and R Programming Language

Learn Machine Learning Algorithms by doing projects in Python and R Programming Language. This repo covers all aspect of Machine Learning Algorithms.

Ravi Chaubey 6 Oct 20, 2022