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
Aesara of Lucania ( el, Αἰσάρα ''Aisara''; 4th or 3rd century BC) was a Pythagorean philosopher who wrote ''On Human Nature'', of which a fragment is preserved by Stobaeus.
Life
Aesara is known only from a one-page fragment of her philosoph ...
, 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
ArviZ ( ) is a Python package for exploratory analysis of Bayesian models.
When working with Bayesian models there are a series of related tasks that need to be addressed besides inference itself:
* Diagnoses of the quality of the inference, ...
to handle plotting, diagnostics, and statistical checks. PyMC and
Stan
Stan or STAN may refer to:
People
* Stan (given name), a list of people with the given name
** Stan Laurel (1890–1965), English comic actor, part of duo Laurel and Hardy
* Stan (surname), a Romanian surname
* Stan! (born 1964), American author ...
are the two most popular
probabilistic programming tools.
PyMC is an
open source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
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 astronomical object, celestial objects and phenomena. It uses mathematics, physics, and chemistry in order to explain their origin and chronology of the Universe, evolution. Objects of interest ...
,
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 evidenc ...
,
molecular biology,
crystallography,
chemistry
Chemistry is the science, scientific study of the properties and behavior of matter. It is a natural science that covers the Chemical element, elements that make up matter to the chemical compound, compounds made of atoms, molecules and ions ...
,
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, development ...
,
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 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 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
*
Variational inference
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 ...
algorithms:
** Black-box Variational Inference
See also
*
Stan
Stan or STAN may refer to:
People
* Stan (given name), a list of people with the given name
** Stan Laurel (1890–1965), English comic actor, part of duo Laurel and Hardy
* Stan (surname), a Romanian surname
* Stan! (born 1964), American author ...
is a probabilistic programming language for statistical inference written in C++
*
ArviZ
ArviZ ( ) is a Python package for exploratory analysis of Bayesian models.
When working with Bayesian models there are a series of related tasks that need to be addressed besides inference itself:
* Diagnoses of the quality of the inference, ...
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 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, continuous ...
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