PyRoss API

PyRoss banner

PyRoss is a numerical library for inference, prediction and non-pharmaceutical interventions in age-structured epidemiological compartment models.

The library is designed to be model-agnostic and allows the user to define models in a JSON format. The most common epidemiological models, and several less common ones, come pre-defined with the library. Models can include stages to allow for non-exponentially distributed compartmental residence times. Currently, pre-defined models include ones with multiple infectious (symptomatic, asymptomatic etc) and non-infectious (exposed, asymptomatic etc) classes.

The library supports models formulated stochastically (as chemical master equations) or deterministically (as systems of differential equations). A hybrid algorithm transits dynamically between these depending on the magnitude of the compartmental fluctuations.

Inference on pre-defined or user-defined models is performed using model-adapted Gaussian processes on the epidemiological manifold or its tangent space. This method allows for latent variable inference and fast computation of the model evidence and the Fisher information matrix. 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 modifications of the contact structures of the model. Optimised control of these structures, given cost functions, is possible. This feature is being actively developed to be better integrated with the library.

See installation instructions and more details in the on GitHub.

Worked out examples

In addition please have a look at the examples folder for more Jupyter notebook examples.

The examples are classified as:

  • contactMatrix : shows how to use contact matrix and intervention
  • control : shows how to compute time dependent contact matrix which depend of time and state
  • deterministic : is for integration of equations of motion in the limit of no stochastic components
  • forecast : is for forecasting once the parameters are known
  • hybrid : is for integration of equations of motion which can switch from deterministic to stochastic
  • inference : shows how to infer parameters and select models given data
  • stochastic : is for integration of equations of motion with stochastic components

Models.pdf has a description of the various epidemiological models used in the examples (SIR, SIkR, SEIR, SEAIR, Spp, etc).