Probabilistic programming

Software system for statistical models

This article relies excessively on references to primary sources. Please improve this article by adding secondary or tertiary sources.
Find sources: "Probabilistic programming" – news · newspapers · books · scholar · JSTOR (December 2014) (Learn how and when to remove this message)

|

Probabilistic programming (PP) is a programming paradigm based on the declarative specification of probabilistic models, for which inference is performed automatically.[1] Probabilistic programming attempts 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 following the probabilistic programming paradigm are referred to as "probabilistic programming languages" (PPLs).

## Applications

[edit]

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

[edit]

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

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

### Relational

[edit]

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

[edit]

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

### List of probabilistic programming languages

[edit]

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

This article may contain an excessive amount of intricate detail that may interest only a particular audience. Please help by spinning off or relocating any relevant information, and removing excessive detail that may be against Wikipedia's inclusion policy. (October 2019) (Learn how and when to remove this message)

|

Name | Extends from | Host language

|
|

Analytica[19] |  | C++
bayesloop[20][21] | Python | Python
Bean Machine[22] | PyTorch | Python
Venture[23] | Scheme | C++
BayesDB[24] | SQLite, Python |
PRISM[14] | B-Prolog |
Infer.NET[13] | .NET Framework | .NET Framework
diff-SAT[25] | Answer set programming, SAT (DIMACS CNF) |
PSQL[26] | SQL |
BUGS[15] |  | Component Pascal
Dyna[27] | Prolog |
Figaro[28] | Scala | Scala
ProbLog[29] | Prolog | Python
ProBT[30] | C++, Python |
Stan[16] | BUGS | C++
Hakaru[31] | Haskell | Haskell
BAli-Phy (software)[32] | Haskell | C++
ProbCog[33] |  | Java, Python
PyMC[34] | Python | Python
Rainier[35][36] | Scala  | Scala
greta[37] | TensorFlow  | R
pomegranate[38] | Python  | Python
Lea[39] | Python | Python
WebPPL[40] | JavaScript | JavaScript
Picture[4] | Julia  | Julia
Turing.jl[12] | Julia | Julia
Gen[41] | Julia | Julia
Edward[42] | TensorFlow | Python
TensorFlow Probability[43] | TensorFlow  | Python
Edward2[44] | TensorFlow Probability  | Python
Pyro[45] | PyTorch | Python
NumPyro[46] | JAX | Python
Birch[47] |  | C++
PSI[48] |  | D
Blang[49] |  |
MultiVerse[50] | Python  | Python
Anglican[51] | Clojure | Clojure

## Difficulty

[edit]

* Reasoning about variables as probability distributions causes difficulties for novice programmers, but these difficulties can be addressed through use of Bayesian network visualizations and graphs of variable distributions embedded within the source code editor.[52]
* As many PPLs rely on the specification of priors on the variables of interest, specifying informed priors is often difficult for novices. In some cases, libraries such as PyMC provide automated methods to find the parameterization of informed priors.[53]

## See also

[edit]

* Statistical relational learning
* Inductive programming
* Bayesian programming
* Plate notation

## Notes

[edit]

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. ^ a b c "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. ^ a b "The Turing language for probabilistic programming". GitHub. December 28, 2021.
13. ^ a b "Infer.NET". microsoft.com. Microsoft.
14. ^ a b "PRISM: PRogramming In Statistical Modeling". rjida.meijo-u.ac.jp. Archived from the original on March 1, 2015. Retrieved July 8, 2015.
15. ^ a b "The BUGS Project - MRC Biostatistics Unit". cam.ac.uk. Archived from the original on March 14, 2014. Retrieved January 12, 2011.
16. ^ a b "Stan". mc-stan.org. Archived from the original on September 3, 2012.
17. ^ "The Algorithms Behind Probabilistic Programming". Retrieved March 10, 2017.
18. ^ 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.
19. ^ "Analytica-- A Probabilistic Modeling Language". lumina.com.
20. ^ "bayesloop - Probabilistic programming framework". bayesloop.com.
21. ^ "GitHub -- bayesloop". GitHub. December 7, 2021.
22. ^ "Bean Machine - A universal probabilistic programming language to enable fast and accurate Bayesian analysis". beanmachine.org.
23. ^ "Venture -- a general-purpose probabilistic programming platform". mit.edu. Archived from the original on January 25, 2016. Retrieved September 20, 2014.
24. ^ "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.
25. ^ "diff-SAT (probabilistic SAT/ASP)". GitHub. October 8, 2021.
26. ^ 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.
27. ^ "Dyna". www.dyna.org. Archived from the original on January 17, 2016. Retrieved January 12, 2011.
28. ^ "Charles River Analytics - Probabilistic Modeling Services". cra.com. February 9, 2017.
29. ^ "ProbLog: Probabilistic Programming". dtai.cs.kuleuven.be.
30. ^ ProbaYes. "ProbaYes - Ensemble, nous valorisations vos données". probayes.com. Archived from the original on March 5, 2016. Retrieved November 26, 2013.
31. ^ "Hakaru Home Page". hakaru-dev.github.io/.
32. ^ "BAli-Phy Home Page". bali-phy.org.
33. ^ "ProbCog". GitHub.
34. ^ PyMC devs. "PyMC". pymc-devs.github.io.
35. ^ stripe/rainier, Stripe, August 19, 2020, retrieved August 26, 2020
36. ^ "Rainier · Bayesian inference for Scala". samplerainier.com. Retrieved August 26, 2020.
37. ^ "greta: simple and scalable statistical modelling in R". GitHub. Retrieved October 2, 2018.
38. ^ "Home — pomegranate 0.10.0 documentation". pomegranate.readthedocs.io. Retrieved October 2, 2018.
39. ^ "Lea Home Page". bitbucket.org.
40. ^ "WebPPL Home Page". github.com/probmods/webppl.
41. ^ "Gen: A General Purpose Probabilistic Programming Language with Programmable Inference". Retrieved June 11, 2024.
42. ^ "Edward – Home". edwardlib.org. Retrieved January 17, 2017.
43. ^ TensorFlow (April 11, 2018). "Introducing TensorFlow Probability". TensorFlow. Retrieved October 2, 2018.
44. ^ "'Edward2' TensorFlow Probability module". GitHub. Retrieved June 11, 2024.
45. ^ "Pyro". pyro.ai. Retrieved February 9, 2018.
46. ^ "NumPyro". pyro.ai. Retrieved July 23, 2021.
47. ^ "Probabilistic Programming in Birch". birch-lang.org. Retrieved April 20, 2018.
48. ^ "PSI Solver - Exact inference for probabilistic programs". psisolver.org. Retrieved August 18, 2019.
49. ^ "Home". www.stat.ubc.ca.
50. ^ 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
51. ^ "The Anglican Probabilistic Programming System". probprog.github.io. Retrieved October 7, 2024.
52. ^ 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.
53. ^ "pymc.find_constrained_prior — PyMC dev documentation". www.pymc.io. Retrieved October 23, 2024.

## External links

[edit]

* Foundations of Probabilistic Programming
* List of Probabilistic Model Mini Language Toolkits

* v
* t
* e

Programming paradigms (Comparison by language)

Imperative|

| Structured|

* Jackson structures
* Block-structured
* Modular
* Non-structured
* Procedural
* Programming in the large and in the small
* Design by contract
* Invariant-based
* Nested function

|

Object-oriented
(comparison, list)|

* Class-based, Prototype-based, Object-based
* Agent
* Immutable object
* Persistent
* Uniform function call syntax

Declarative|

| Functional
(comparison)|

* Recursive
* Anonymous function (Partial application)
* Higher-order
* Purely functional
* Total
* Strict
* GADTs
* Dependent types
* Functional logic
* Point-free style
* Expression-oriented
* Applicative, Concatenative
* Function-level, Value-level

|

Dataflow|

* Flow-based
* Reactive (Functional reactive)
* Signals
* Streams
* Synchronous

Logic|

* Abductive logic
* Answer set
* Constraint (Constraint logic)
* Inductive logic
* Nondeterministic
* Ontology
* Probabilistic logic
* Query

DSL|

* Algebraic modeling
* Array
* Automata-based (Action)
* Command (Spacecraft)
* Differentiable
* End-user
* Grammar-oriented
* Interface description
* Language-oriented
* List comprehension
* Low-code
* Modeling
* Natural language
* Non-English-based
* Page description
* Pipes and filters
* Probabilistic
* Quantum
* Scientific
* Scripting
* Set-theoretic
* Simulation
* Stack-based
* System
* Tactile
* Templating
* Transformation (Graph rewriting, Production, Pattern)
* Visual

Concurrent,
distributed,
parallel|

* Actor-based
* Automatic mutual exclusion
* Choreographic programming
* Concurrent logic (Concurrent constraint logic)
* Concurrent OO
* Macroprogramming
* Multitier programming
* Organic computing
* Parallel programming models
* Partitioned global address space
* Process-oriented
* Relativistic programming
* Service-oriented
* Structured concurrency

Metaprogramming|

* Attribute-oriented
* Automatic (Inductive)
* Dynamic
* Extensible
* Generic
* Homoiconicity
* Interactive
* Macro (Hygienic)
* Metalinguistic abstraction
* Multi-stage
* Program synthesis (Bayesian, Inferential, by demonstration, by example)
* Reflective
* Self-modifying code
* Symbolic
* Template

Separation
of concerns|

* Aspects
* Components
* Data-driven
* Data-oriented
* Event-driven
* Features
* Literate
* Roles
* Subjects

*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template