Probabilistic programming

Last updated

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.

Contents

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

Probabilistic programming languages

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

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

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]

List of probabilistic programming languages

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

NameExtends fromHost language
Analytica [20] C++
bayesloop [21] [22] PythonPython
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] MATLABMATLAB
Alchemy [36] C++
Dyna [37] Prolog
Figaro [38] ScalaScala
Church [39] SchemeVarious: JavaScript, Scheme
ProbLog [40] PrologPython
ProBT [41] C++, Python
Stan [17] BUGSC++
Hakaru [42] Haskell Haskell
BAli-Phy (software) [43] HaskellC++
ProbCog [44] Java, Python
Gamble [45] Racket
PWhile [46] WhilePython
Tuffy [47] Java
PyMC [48] PythonPython
Rainier [49] [50] ScalaScala
greta [51] TensorFlow R
pomegranate [52] PythonPython
Lea [53] PythonPython
WebPPL [54] JavaScriptJavaScript
Let's Chance [55] ScratchJavaScript
Picture [4] JuliaJulia
Turing.jl [56] Julia Julia
Gen [57] Julia Julia
Low-level First-order PPL [58] Python, Clojure, PytorchVarious: Python, Clojure
Troll [59] Moscow ML
Edward [60] TensorFlow Python
TensorFlow Probability [61] TensorFlowPython
Edward2 [62] TensorFlow ProbabilityPython
Pyro [63] PyTorch Python
NumPyro [64] JAX Python
Saul [65] ScalaScala
RankPL [66] Java
Birch [67] C++
PSI [68] D
Blang [69]
MultiVerse [70] PythonPython

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

See also

Notes

  1. "Probabilistic programming does in 50 lines of code what used to take thousands". phys.org. April 13, 2015. Retrieved April 13, 2015.
  2. "Probabilistic Programming". probabilistic-programming.org. Archived from the original on January 10, 2016. Retrieved December 24, 2013.
  3. Pfeffer, Avrom (2014), Practical Probabilistic Programming, Manning Publications. p.28. ISBN   978-1 6172-9233-0
  4. 1 2 3 "Short probabilistic programming machine-learning code replaces complex programs for computer-vision tasks". KurzweilAI. April 13, 2015. Retrieved November 27, 2017.
  5. Hardesty, Larry (April 13, 2015). "Graphics in reverse".
  6. "MIT shows off machine-learning script to make CREEPY HEADS". The Register .
  7. "MIT's Gen programming system flattens the learning curve for AI projects". VentureBeat. June 27, 2019. Retrieved June 27, 2019.
  8. Semenova, Elizaveta; Williams, Dominic P.; Afzal, Avid M.; Lazic, Stanley E. (November 1, 2020). "A Bayesian neural network for toxicity prediction". Computational Toxicology. 16: 100133. doi:10.1016/j.comtox.2020.100133. ISSN   2468-1113. S2CID   225362130.
  9. Williams, Dominic P.; Lazic, Stanley E.; Foster, Alison J.; Semenova, Elizaveta; Morgan, Paul (2020), "Predicting Drug-Induced Liver Injury with Bayesian Machine Learning", Chemical Research in Toxicology, 33 (1): 239–248, doi:10.1021/acs.chemrestox.9b00264, PMID   31535850, S2CID   202689667
  10. Innes, Mike; Edelman, Alan; Fischer, Keno; Rackauckas, Chris; Saba, Elliot; Viral B Shah; Tebbutt, Will (2019). "∂P: A Differentiable Programming System to Bridge Machine Learning and Scientific Computing". arXiv: 1907.07587 [cs.PL].
  11. 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. Retrieved May 27, 2023.
  12. 1 2 "Dimple Home Page". analog.com. July 2, 2021.
  13. 1 2 "Chimple Home Page". analog.com. April 16, 2021.
  14. 1 2 "Infer.NET". microsoft.com. Microsoft.
  15. 1 2 "PRISM: PRogramming In Statistical Modeling". rjida.meijo-u.ac.jp. Archived from the original on March 1, 2015. Retrieved July 8, 2015.
  16. 1 2 "The BUGS Project - MRC Biostatistics Unit". cam.ac.uk. Archived from the original on March 14, 2014. Retrieved January 12, 2011.
  17. 1 2 "Stan". mc-stan.org. Archived from the original on September 3, 2012.
  18. "The Algorithms Behind Probabilistic Programming" . Retrieved March 10, 2017.
  19. De Raedt, Luc; Kimmig, Angelika (July 1, 2015). "Probabilistic (logic) programming concepts". Machine Learning. 100 (1): 5–47. doi:10.1007/s10994-015-5494-z. ISSN   1573-0565.
  20. "Analytica-- A Probabilistic Modeling Language". lumina.com.
  21. "bayesloop - Probabilistic programming framework". bayesloop.com.
  22. "GitHub -- bayesloop". GitHub . December 7, 2021.
  23. "Bean Machine - A universal probabilistic programming language to enable fast and accurate Bayesian analysis". beanmachine.org.
  24. "Probabilistic Programming with CuPPL". popl19.sigplan.org.
  25. Collins, Alexander; Grewe, Dominik; Grover, Vinod; Lee, Sean; Susnea, Adriana (June 9, 2014). "NOVA: A Functional Language for Data Parallelism". Proceedings of ACM SIGPLAN International Workshop on Libraries, Languages, and Compilers for Array Programming. Array'14. pp. 8–13. doi:10.1145/2627373.2627375. ISBN   9781450329378. S2CID   6748967.{{cite book}}: |work= ignored (help)
  26. "Venture -- a general-purpose probabilistic programming platform". mit.edu. Archived from the original on January 25, 2016. Retrieved September 20, 2014.
  27. "Probabilistic C". ox.ac.uk. Archived from the original on January 4, 2016. Retrieved March 24, 2015.
  28. "The Anglican Probabilistic Programming System". ox.ac.uk. January 6, 2021.
  29. "IBAL Home Page". Archived from the original on December 26, 2010.
  30. "BayesDB on SQLite. A Bayesian database table for querying the probable implications of data as easily as SQL databases query the data itself". GitHub. December 26, 2021.
  31. "Bayesian Logic (BLOG)". mit.edu. Archived from the original on June 16, 2011.
  32. "diff-SAT (probabilistic SAT/ASP)". GitHub . October 8, 2021.
  33. Dey, Debabrata; Sarkar, Sumit (1998). "PSQL: A query language for probabilistic relational data". Data & Knowledge Engineering. 28: 107–120. doi:10.1016/S0169-023X(98)00015-9.
  34. "Factorie - Probabilistic programming with imperatively-defined factor graphs - Google Project Hosting". google.com.
  35. "PMTK3 - probabilistic modeling toolkit for Matlab/Octave, version 3 - Google Project Hosting". google.com.
  36. "Alchemy - Open Source AI". washington.edu.
  37. "Dyna". www.dyna.org. Archived from the original on January 17, 2016. Retrieved January 12, 2011.
  38. "Charles River Analytics - Probabilistic Modeling Services". cra.com. February 9, 2017.
  39. "Church". mit.edu. Archived from the original on January 14, 2016. Retrieved April 8, 2013.
  40. "ProbLog: Probabilistic Programming". dtai.cs.kuleuven.be.
  41. ProbaYes. "ProbaYes - Ensemble, nous valorisations vos données". probayes.com. Archived from the original on March 5, 2016. Retrieved November 26, 2013.
  42. "Hakaru Home Page". hakaru-dev.github.io/.
  43. "BAli-Phy Home Page". bali-phy.org.
  44. "ProbCog". GitHub.
  45. Culpepper, Ryan (January 17, 2017). "gamble: Probabilistic Programming" via GitHub.
  46. "PWhile Compiler". GitHub. May 25, 2020.
  47. "Tuffy: A Scalable Markov Logic Inference Engine". stanford.edu.
  48. PyMC devs. "PyMC". pymc-devs.github.io.
  49. stripe/rainier, Stripe, August 19, 2020, retrieved August 26, 2020
  50. "Rainier · Bayesian inference for Scala". samplerainier.com. Retrieved August 26, 2020.
  51. "greta: simple and scalable statistical modelling in R". GitHub. Retrieved October 2, 2018.
  52. "Home — pomegranate 0.10.0 documentation". pomegranate.readthedocs.io. Retrieved October 2, 2018.
  53. "Lea Home Page". bitbucket.org.
  54. "WebPPL Home Page". github.com/probmods/webppl.
  55. Let's Chance: Playful Probabilistic Programming for Children | Extended Abstracts of the 2020 CHI Conference on Human Factors in Computing Systems. Chi Ea '20. April 25, 2020. pp. 1–7. doi:10.1145/3334480.3383071. ISBN   9781450368193. S2CID   216079395 . Retrieved August 1, 2020.{{cite book}}: |website= ignored (help)
  56. "The Turing language for probabilistic programming". GitHub . December 28, 2021.
  57. "Gen: A General Purpose Probabilistic Programming Language with Programmable Inference" . Retrieved June 17, 2019.
  58. "LF-PPL: A Low-Level First Order Probabilistic Programming Language for Non-Differentiable Models". ox.ac.uk. November 2, 2019.
  59. "Troll dice roller and probability calculator". topps.diku.dk.
  60. "Edward – Home". edwardlib.org. Retrieved January 17, 2017.
  61. TensorFlow (April 11, 2018). "Introducing TensorFlow Probability". TensorFlow. Retrieved October 2, 2018.
  62. "'Edward2' TensorFlow Probability module". GitHub. Retrieved October 2, 2018.
  63. "Pyro". pyro.ai. Retrieved February 9, 2018.
  64. "NumPyro". pyro.ai. Retrieved July 23, 2021.
  65. "CogComp - Home".
  66. Rienstra, Tjitze (January 18, 2018), RankPL: A qualitative probabilistic programming language based on ranking theory , retrieved January 18, 2018
  67. "Probabilistic Programming in Birch". birch-lang.org. Retrieved April 20, 2018.
  68. "PSI Solver - Exact inference for probabilistic programs". psisolver.org. Retrieved August 18, 2019.
  69. "Home". www.stat.ubc.ca.
  70. Perov, Yura; Graham, Logan; Gourgoulias, Kostis; Richens, Jonathan G.; Lee, Ciarán M.; Baker, Adam; Johri, Saurabh (January 28, 2020), MultiVerse: Causal Reasoning using Importance Sampling in Probabilistic Programming, arXiv: 1910.08091
  71. Gorinova, Maria I.; Sarkar, Advait; Blackwell, Alan F.; Syme, Don (January 1, 2016). "A Live, Multiple-Representation Probabilistic Programming Environment for Novices". Proceedings of the 2016 CHI Conference on Human Factors in Computing Systems. CHI '16. New York, NY, USA: ACM. pp. 2533–2537. doi:10.1145/2858036.2858221. ISBN   9781450333627. S2CID   3201542.

Related Research Articles

Inductive logic programming (ILP) is a subfield of symbolic artificial intelligence which uses logic programming as a uniform representation for examples, background knowledge and hypotheses. The term "inductive" here refers to philosophical rather than mathematical induction. Given an encoding of the known background knowledge and a set of examples represented as a logical database of facts, an ILP system will derive a hypothesised logic program which entails all the positive and none of the negative examples.

A Bayesian network is a probabilistic graphical model that represents a set of variables and their conditional dependencies via a directed acyclic graph (DAG). While it is one of several forms of causal notation, causal networks are special cases of Bayesian networks. Bayesian networks are ideal for taking an event that occurred and predicting the likelihood that any one of several possible known causes was the contributing factor. For example, a Bayesian network could represent the probabilistic relationships between diseases and symptoms. Given symptoms, the network can be used to compute the probabilities of the presence of various diseases.

Solomonoff's theory of inductive inference is a mathematical theory of induction introduced by Ray Solomonoff, based on probability theory and theoretical computer science. In essence, Solomonoff's induction derives the posterior probability of any computable theory, given a sequence of observed data. This posterior probability is derived from Bayes' rule and some universal prior, that is, a prior that assigns a positive probability to any computable theory.

<span class="mw-page-title-main">Dynamic Bayesian network</span> Probabilistic graphical model

A dynamic Bayesian network (DBN) is a Bayesian network (BN) which relates variables to each other over adjacent time steps.

Formal epistemology uses formal methods from decision theory, logic, probability theory and computability theory to model and reason about issues of epistemological interest. Work in this area spans several academic fields, including philosophy, computer science, economics, and statistics. The focus of formal epistemology has tended to differ somewhat from that of traditional epistemology, with topics like uncertainty, induction, and belief revision garnering more attention than the analysis of knowledge, skepticism, and issues with justification.

A Markov logic network (MLN) is a probabilistic logic which applies the ideas of a Markov network to first-order logic, defining probability distributions on possible worlds on any given domain.

Probabilistic logic involves the use of probability and logic to deal with uncertain situations. Probabilistic logic extends traditional logic truth tables with probabilistic expressions. A difficulty of probabilistic logics is their tendency to multiply the computational complexities of their probabilistic and logical components. Other difficulties include the possibility of counter-intuitive results, such as in case of belief fusion in Dempster–Shafer theory. Source trust and epistemic uncertainty about the probabilities they provide, such as defined in subjective logic, are additional elements to consider. The need to deal with a broad variety of contexts and issues has led to many different proposals.

Statistical relational learning (SRL) is a subdiscipline of artificial intelligence and machine learning that is concerned with domain models that exhibit both uncertainty and complex, relational structure. Typically, the knowledge representation formalisms developed in SRL use first-order logic to describe relational properties of a domain in a general manner and draw upon probabilistic graphical models to model the uncertainty; some also build upon the methods of inductive logic programming. Significant contributions to the field have been made since the late 1990s.

A probabilistic logic network (PLN) is a conceptual, mathematical and computational approach to uncertain inference; inspired by logic programming, but using probabilities in place of crisp (true/false) truth values, and fractional uncertainty in place of crisp known/unknown values. In order to carry out effective reasoning in real-world circumstances, artificial intelligence software must robustly handle uncertainty. However, previous approaches to uncertain inference do not have the breadth of scope required to provide an integrated treatment of the disparate forms of cognitively critical uncertainty as they manifest themselves within the various forms of pragmatic inference. Going beyond prior probabilistic approaches to uncertain inference, PLN is able to encompass within uncertain logic such ideas as induction, abduction, analogy, fuzziness and speculation, and reasoning about time and causality.

Inductive programming (IP) is a special area of automatic programming, covering research from artificial intelligence and programming, which addresses learning of typically declarative and often recursive programs from incomplete specifications, such as input/output examples or constraints.

<span class="mw-page-title-main">Stan (software)</span> Probabilistic programming language for Bayesian inference

Stan is a probabilistic programming language for statistical inference written in C++. The Stan language is used to specify a (Bayesian) statistical model with an imperative program calculating the log probability density function.

<span class="mw-page-title-main">Probabilistic soft logic</span>

Probabilistic Soft Logic (PSL) is a statistical relational learning (SRL) framework for modeling probabilistic and relational domains. It is applicable to a variety of machine learning problems, such as collective classification, entity resolution, link prediction, and ontology alignment. PSL combines two tools: first-order logic, with its ability to succinctly represent complex phenomena, and probabilistic graphical models, which capture the uncertainty and incompleteness inherent in real-world knowledge. More specifically, PSL uses "soft" logic as its logical component and Markov random fields as its statistical model. PSL provides sophisticated inference techniques for finding the most likely answer (i.e. the maximum a posteriori (MAP) state). The "softening" of the logical formulas makes inference a polynomial time operation rather than an NP-hard operation.

<span class="mw-page-title-main">TensorFlow</span> Machine learning software library

TensorFlow is a free and open-source software library for machine learning and artificial intelligence. It can be used across a range of tasks but has a particular focus on training and inference of deep neural networks.

This glossary of artificial intelligence is a list of definitions of terms and concepts relevant to the study of artificial intelligence, its sub-disciplines, and related fields. Related glossaries include Glossary of computer science, Glossary of robotics, and Glossary of machine vision.

PyMC is a probabilistic programming language written in Python. It can be used for Bayesian statistical modeling and probabilistic machine learning.

The following outline is provided as an overview of and topical guide to machine learning:

<span class="mw-page-title-main">Infer.NET</span> Microsoft open source library

Infer.NET is a free and open source .NET software library for machine learning. It supports running Bayesian inference in graphical models and can also be used for probabilistic programming.

ProbLog is a probabilistic logic programming language that extends Prolog with probabilities. It minimally extends Prolog by adding the notion of a probabilistic fact, which combines the idea of logical atoms and random variables. Similarly to Prolog, ProbLog can query an atom. While Prolog returns the truth value of the queried atom, ProbLog returns the probability of it being true.

Probabilistic logic programming is a programming paradigm that combines logic programming with probabilities.