Probabilistic programming explained

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).

Applications

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.

Probabilistic programming in Julia has also been combined with differentiable programming by combining the Julia package Zygote.jl with Turing.jl. [9]

Probabilistic programming languages are also commonly used in Bayesian cognitive science to develop and evaluate models of cognition. [10]

Probabilistic programming languages

PPLs often extend from a basic language. For instance, Turing.jl is based on Julia, Infer.NET is based on .NET Framework, while PRISM extends from Prolog. 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.

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 program WinBUGS (or related R packages, rbugs and r2winbugs) and JAGS (Just Another Gibbs Sampler, another standalone program with related R packages including rjags, R2jags, and runjags). 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.[11]

Relational

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.

Probabilistic logic programming

See 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.[12]

List of probabilistic programming languages

This list summarises the variety of PPLs that are currently available, and clarifies their origins.

Name Extends from Host language
C++
bayesloop Python Python
Bean Machine Python
Venture C++
BayesDB
PRISM
.NET Framework .NET Framework
diff-SAT
BUGS Component Pascal
Dyna
Figaro Scala Scala
Prolog Python
ProBT
BUGSC++
Hakaru Haskell
BAli-Phy (software) Haskell C++
ProbCog Java, Python
Python Cython
PythonPython
Rainier[13] ScalaScala
greta[14] TensorFlowR
pomegranate[15] PythonPython
Lea Python Python
WebPPLJavaScriptJavaScript
PictureJuliaJulia
Turing.jlJuliaJulia
Gen[16] JuliaJulia
Edward[17] TensorFlowPython
TensorFlow Probability[18] TensorFlowPython
Edward2[19] TensorFlow ProbabilityPython
Pyro[20] PyTorchPython
NumPyro[21] JAXPython
Birch[22] C++
PSI[23] D
Blang[24]
MultiVersePythonPython

Difficulty

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.[25]

See also

External links

Notes and References

  1. News: Probabilistic programming does in 50 lines of code what used to take thousands . phys.org . April 13, 2015 . 2015-04-13 .
  2. Web site: Probabilistic Programming. probabilistic-programming.org. December 24, 2013. https://web.archive.org/web/20160110035042/http://probabilistic-programming.org/wiki/Home. January 10, 2016. dead.
  3. Pfeffer, Avrom (2014), Practical Probabilistic Programming, Manning Publications. p.28.
  4. News: Short probabilistic programming machine-learning code replaces complex programs for computer-vision tasks. April 13, 2015. KurzweilAI. 27 Nov 2017.
  5. Web site: Graphics in reverse . Larry . Hardesty . April 13, 2015.
  6. Web site: MIT shows off machine-learning script to make CREEPY HEADS. The Register.
  7. Web site: MIT's Gen programming system flattens the learning curve for AI projects. 2019-06-27. VentureBeat. en-US. 2019-06-27.
  8. Semenova. Elizaveta. Williams. Dominic P.. Afzal. Avid M.. Lazic. Stanley E.. 2020-11-01. A Bayesian neural network for toxicity prediction. Computational Toxicology. en. 16. 100133. 10.1016/j.comtox.2020.100133. 225362130. 2468-1113.
  9. 2019. ∂P: A Differentiable Programming System to Bridge Machine Learning and Scientific Computing. 1907.07587. Innes. Mike. Edelman. Alan. Fischer. Keno. Rackauckas. Chris. Saba. Elliot. Viral B Shah. Tebbutt. Will. cs.PL .
  10. Web site: Goodman . Noah D . Tenenbaum . Joshua B . Buchsbaum . Daphna . Hartshorne . Joshua . Hawkins . Robert . O'Donnell . Timothy J . Tessler . Michael Henry . Probabilistic Models of Cognition . Probabilistic Models of Cognition - 2nd Edition . 27 May 2023.
  11. Web site: The Algorithms Behind Probabilistic Programming. 2017-03-10.
  12. De Raedt . Luc . Kimmig . Angelika . 2015-07-01 . Probabilistic (logic) programming concepts . Machine Learning . en . 100 . 1 . 5–47 . 10.1007/s10994-015-5494-z . 1573-0565.
  13. Web site: Rainier · Bayesian inference for Scala. 2020-08-26. samplerainier.com.
  14. Web site: greta: simple and scalable statistical modelling in R. GitHub. 2018-10-02.
  15. Web site: Home — pomegranate 0.10.0 documentation. pomegranate.readthedocs.io. en. 2018-10-02.
  16. Web site: Gen: A General Purpose Probabilistic Programming Language with Programmable Inference. 2024-06-11.
  17. Web site: Edward – Home. edwardlib.org. 2017-01-17.
  18. Web site: Introducing TensorFlow Probability. TensorFlow. 2018-04-11. TensorFlow. 2018-10-02.
  19. Web site: 'Edward2' TensorFlow Probability module. GitHub. en. 2024-06-11.
  20. Web site: Pyro. pyro.ai. en. 2018-02-09.
  21. Web site: NumPyro. pyro.ai. en. 2021-07-23.
  22. Web site: Probabilistic Programming in Birch. birch-lang.org. 2018-04-20.
  23. Web site: PSI Solver - Exact inference for probabilistic programs. psisolver.org. 2019-08-18.
  24. Web site: Home. www.stat.ubc.ca.
  25. Book: Gorinova. Maria I.. Sarkar. Advait. Blackwell. Alan F.. Syme. Don. Proceedings of the 2016 CHI Conference on Human Factors in Computing Systems . A Live, Multiple-Representation Probabilistic Programming Environment for Novices . 2016-01-01. CHI '16. New York, NY, USA. ACM. 2533–2537. 10.1145/2858036.2858221. 9781450333627. 3201542.