Probabilistic programming (PP) is a programming paradigm in which probabilistic models are specified and inference for these models is performed automatically.^{[1]} It represents an attempt to unify probabilistic modeling and traditional general purpose programming in order to make the former easier and more widely applicable.^{[2]}^{[3]} It can be used to create systems that help make decisions in the face of uncertainty.
Programming languages used for probabilistic programming are referred to as "probabilistic programming languages" (PPLs).
Probabilistic reasoning has been used for a wide variety of tasks such as predicting stock prices, recommending movies, diagnosing computers, detecting cyber intrusions and image detection.^{[4]} However, until recently (partially due to limited computing power), probabilistic programming was limited in scope, and most inference algorithms had to be written manually for each task.
Nevertheless, in 2015, a 50-line probabilistic computer vision program was used to generate 3D models of human faces based on 2D images of those faces. The program used inverse graphics as the basis of its inference method, and was built using the Picture package in Julia.^{[4]} This made possible "in 50 lines of code what used to take thousands".^{[5]}^{[6]}
The Gen probabilistic programming library (also written in Julia) has been applied to vision and robotics tasks.^{[7]}
More recently, the probabilistic programming system Turing.jl has been applied in various pharmaceutical^{[8]} and economics applications.^{[9]}
Probabilistic programming in Julia has also been combined with differentiable programming by combining the Julia package Zygote.jl with Turing.jl. ^{[10]}
Probabilistic programming languages are also commonly used in Bayesian cognitive science to develop and evaluate models of cognition. ^{[11]}
PPLs often extend from a basic language. The choice of underlying basic language depends on the similarity of the model to the basic language's ontology, as well as commercial considerations and personal preference. For instance, Dimple^{[12]} and Chimple^{[13]} are based on Java, Infer.NET is based on .NET Framework,^{[14]} while PRISM extends from Prolog.^{[15]} However, some PPLs such as WinBUGS offer a self-contained language, that maps closely to the mathematical representation of the statistical models, with no obvious origin in another programming language.^{[16]}^{[17]}
The language for winBUGS was implemented to perform Bayesian computation using Gibbs Sampling (and related algorithms). Although implemented in a relatively unknown programming language (Component Pascal), this language permits Bayesian inference for a wide variety of statistical models using a flexible computational approach. The same BUGS language may be used to specify Bayesian models for inference via different computational choices ("samplers") and conventions or defaults, using a standalone package winBUGS (or related R packages, rbugs and r2winbugs) and JAGS (Just Another Gibbs Sampler, another R package). More recently, other languages to support Bayesian model specification and inference allow different or more efficient choices for the underlying Bayesian computation, and are accessible from the R data analysis and programming environment, e.g.: Stan, NIMBLE and NUTS. The influence of the BUGS language is evident in these later languages, which even use the same syntax for some aspects of model specification.
Several PPLs are in active development, including some in beta test. Two popular tools are Stan and PyMC.^{[18]}
A probabilistic relational programming language (PRPL) is a PPL specially designed to describe and infer with probabilistic relational models (PRMs).
A PRM is usually developed with a set of algorithms for reducing, inference about and discovery of concerned distributions, which are embedded into the corresponding PRPL.
Main article: Probabilistic logic programming |
Probabilistic logic programming is a programming paradigm that extends logic programming with probabilities.
Most approaches to probabilistic logic programming are based on the distribution semantics, which splits a program into a set of probabilistic facts and a logic program. It defines a probability distribution on interpretations of the Herbrand universe of the program.^{[19]}
This list summarises the variety of PPLs that are currently available, and clarifies their origins.
Name | Extends from | Host language |
---|---|---|
Analytica^{[20]} | C++ | |
bayesloop^{[21]}^{[22]} | Python | Python |
Bean Machine^{[23]} | PyTorch | Python |
CuPPL^{[24]} | NOVA^{[25]} | |
Venture^{[26]} | Scheme | C++ |
Probabilistic-C^{[27]} | C | C |
Anglican^{[28]} | Clojure | Clojure |
IBAL^{[29]} | OCaml | |
BayesDB^{[30]} | SQLite, Python | |
PRISM^{[15]} | B-Prolog | |
Infer.NET^{[14]} | .NET Framework | .NET Framework |
dimple^{[12]} | MATLAB, Java | |
chimple^{[13]} | MATLAB, Java | |
BLOG^{[31]} | Java | |
diff-SAT^{[32]} | Answer set programming, SAT (DIMACS CNF) | |
PSQL^{[33]} | SQL | |
BUGS^{[16]} | Component Pascal | |
FACTORIE^{[34]} | Scala | Scala |
PMTK^{[35]} | MATLAB | MATLAB |
Alchemy^{[36]} | C++ | |
Dyna^{[37]} | Prolog | |
Figaro^{[38]} | Scala | Scala |
Church^{[39]} | Scheme | Various: JavaScript, Scheme |
ProbLog^{[40]} | Prolog | Python |
ProBT^{[41]} | C++, Python | |
Stan^{[17]} | BUGS | C++ |
Hakaru^{[42]} | Haskell | Haskell |
BAli-Phy (software)^{[43]} | Haskell | C++ |
ProbCog^{[44]} | Java, Python | |
Gamble^{[45]} | Racket | |
PWhile^{[46]} | While | Python |
Tuffy^{[47]} | Java | |
PyMC^{[48]} | Python | Python |
Rainier^{[49]}^{[50]} | Scala | Scala |
greta^{[51]} | TensorFlow | R |
pomegranate^{[52]} | Python | Python |
Lea^{[53]} | Python | Python |
WebPPL^{[54]} | JavaScript | JavaScript |
Let's Chance^{[55]} | Scratch | JavaScript |
Picture^{[4]} | Julia | Julia |
Turing.jl^{[56]} | Julia | Julia |
Gen^{[57]} | Julia | Julia |
Low-level First-order PPL^{[58]} | Python, Clojure, Pytorch | Various: Python, Clojure |
Troll^{[59]} | Moscow ML | |
Edward^{[60]} | TensorFlow | Python |
TensorFlow Probability^{[61]} | TensorFlow | Python |
Edward2^{[62]} | TensorFlow Probability | Python |
Pyro^{[63]} | PyTorch | Python |
NumPyro^{[64]} | JAX | Python |
Saul^{[65]} | Scala | Scala |
RankPL^{[66]} | Java | |
Birch^{[67]} | C++ | |
PSI^{[68]} | D | |
Blang^{[69]} | ||
MultiVerse^{[70]} | Python | Python |
Reasoning about variables as probability distributions causes difficulties for novice programmers, but these difficulties can be addressed through use of Bayesian network visualisations and graphs of variable distributions embedded within the source code editor.^{[71]}