PyMC (formerly known as PyMC3) is a
Python
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (pro ...
package for Bayesian statistical modeling and probabilistic machine learning which focuses on advanced Markov chain Monte Carlo and variational fitting algorithms.
It is a rewrite from scratch of the previous version of the PyMC software.
Unlike PyMC2, which had used
Fortran extensions for performing computations, PyMC relies on
Aesara, a Python library that allows to define, optimize, and efficiently evaluate mathematical expressions involving multi-dimensional arrays.
From version 3.8 PyMC relies on
ArviZ to handle plotting, diagnostics, and statistical checks. PyMC and
Stan are the two most popular
probabilistic programming
Probabilistic programming (PP) is a programming paradigm in which probabilistic models are specified and inference for these models is performed automatically.
It represents an attempt to unify probabilistic modeling and traditional general pur ...
tools.
PyMC is an
open source project, developed by the community and fiscally sponsored by
NumFOCUS.
PyMC has been used to solve inference problems in several scientific domains, including
astronomy
Astronomy () is a natural science that studies celestial objects and phenomena. It uses mathematics, physics, and chemistry in order to explain their origin and evolution. Objects of interest include planets, moons, stars, nebulae, g ...
,
epidemiology
Epidemiology is the study and analysis of the distribution (who, when, and where), patterns and determinants of health and disease conditions in a defined population.
It is a cornerstone of public health, and shapes policy decisions and evide ...
,
molecular biology,
crystallography,
chemistry,
ecology
and psychology.
Previous versions of PyMC were also used widely, for example in
climate science,
public health,
neuroscience
Neuroscience is the scientific study of the nervous system (the brain, spinal cord, and peripheral nervous system), its functions and disorders. It is a multidisciplinary science that combines physiology, anatomy, molecular biology, developme ...
,
and parasitology.
After
Theano
In Greek mythology, Theano (; Ancient Greek: Θεανώ) may refer to the following personages:
*Theano, wife of Metapontus, king of Icaria. Metapontus demanded that she bear him children, or leave the kingdom. She presented the children of Melan ...
announced plans to discontinue development in 2017, the PyMC team evaluated
TensorFlow Probability as a computational backend, but decided in 2020 to take over the development of Theano.
Large parts of the Theano codebase have been refactored and compilation through JAX and
Numba
Numba is an open-source JIT compiler that translates a subset of Python and NumPy into fast machine code using LLVM, via the llvmlite Python package. It offers a range of options for parallelising Python code for CPUs and GPUs, often with only ...
were added.
The PyMC team has released the revised computational backend under the name Aesara and continue the development of PyMC.
Inference engines
PyMC implements non-gradient-based and gradient-based
Markov chain Monte Carlo
In statistics, Markov chain Monte Carlo (MCMC) methods comprise a class of algorithms for sampling from a probability distribution. By constructing a Markov chain that has the desired distribution as its equilibrium distribution, one can obtain ...
(MCMC) algorithms for Bayesian inference and stochastic, gradient-based
variational Bayesian methods
Variational Bayesian methods are a family of techniques for approximating intractable integrals arising in Bayesian inference and machine learning. They are typically used in complex statistical models consisting of observed variables (usually ...
for approximate Bayesian inference.
* MCMC-based algorithms:
** No-U-Turn sampler
(NUTS), a variant of
Hamiltonian Monte Carlo The Hamiltonian Monte Carlo algorithm (originally known as hybrid Monte Carlo) is a Markov chain Monte Carlo method for obtaining a sequence of random samples which converge to being distributed according to a target probability distribution for whi ...
and PyMC's default engine for continuous variables
**
Metropolis–Hastings, PyMC's default engine for discrete variables
** Sequential Monte Carlo for static posteriors
** Sequential Monte Carlo for
approximate Bayesian computation
Approximate Bayesian computation (ABC) constitutes a class of computational methods rooted in Bayesian statistics that can be used to estimate the posterior distributions of model parameters.
In all model-based statistical inference, the like ...
*
Variational inference algorithms:
** Black-box Variational Inference
See also
*
Stan is a probabilistic programming language for statistical inference written in C++
*
ArviZ a Python library for Exploratory Analysis of Bayesian Models
References
Further reading
Probabilistic Programming and Bayesian Methods for Hackers
External links
PyMC source a
Git
Git () is a distributed version control system: tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data in ...
repository hosted on
GitHub
GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, continu ...
Symbolic PyMCis an experimental set of tools that facilitate sophisticated symbolic manipulation of PyMC models
{{Statistical software
Computational statistics
Free Bayesian statistics software
Monte Carlo software
Numerical programming languages
Probabilistic software
Python (programming language) scientific libraries