Probabilistic programming#Applications

{{Short description|Software system for statistical models}}

{{Use mdy dates|date=September 2015}}

{{primary sources|date=December 2014}}

Probabilistic programming (PP) is a programming paradigm based on the declarative specification of probabilistic models, for which inference is performed automatically.{{cite news

| url=http://phys.org/news/2015-04-probabilistic-lines-code-thousands.html

| title=Probabilistic programming does in 50 lines of code what used to take thousands

| work=phys.org

| date=April 13, 2015

| access-date=2015-04-13 }}

Probabilistic programming attempts to unify probabilistic modeling and traditional general purpose programming in order to make the former easier and more widely applicable.{{cite web|url=http://probabilistic-programming.org/wiki/Home|title=Probabilistic Programming|work=probabilistic-programming.org|access-date=December 24, 2013|archive-url=https://web.archive.org/web/20160110035042/http://probabilistic-programming.org/wiki/Home|archive-date=January 10, 2016|url-status=dead}}Pfeffer, Avrom (2014), Practical Probabilistic Programming, Manning Publications. p.28. {{ISBN|978-1 6172-9233-0}} 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

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.{{cite news|url = http://www.kurzweilai.net/short-probabilistic-programming-machine-learning-code-replaces-complex-programs-for-computer-vision-tasks|title = Short probabilistic programming machine-learning code replaces complex programs for computer-vision tasks|date = April 13, 2015|work = KurzweilAI|access-date = 27 Nov 2017}} 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. This made possible "in 50 lines of code what used to take thousands".{{cite web |url=https://news.mit.edu/2015/better-probabilistic-programming-0413 |title=Graphics in reverse |first=Larry |last=Hardesty |date=April 13, 2015}}{{cite web|url=https://www.theregister.co.uk/2015/04/14/mit_shows_off_machinelearning_script_to_make_creepy_heads/|title=MIT shows off machine-learning script to make CREEPY HEADS|website=The Register}}

The Gen probabilistic programming library (also written in Julia) has been applied to vision and robotics tasks.{{Cite web|url=https://venturebeat.com/2019/06/27/mits-gen-programming-system-allows-users-to-easily-create-computer-vision-statistical-ai-and-robotics-programs/|title=MIT's Gen programming system flattens the learning curve for AI projects|date=2019-06-27|website=VentureBeat|language=en-US|access-date=2019-06-27}}

More recently, the probabilistic programming system Turing.jl has been applied in various pharmaceutical{{Cite journal|last1=Semenova|first1=Elizaveta|last2=Williams|first2=Dominic P.|last3=Afzal|first3=Avid M.|last4=Lazic|first4=Stanley E.|date=2020-11-01|title=A Bayesian neural network for toxicity prediction|url=https://www.sciencedirect.com/science/article/pii/S2468111320300438|journal=Computational Toxicology|language=en|volume=16|pages=100133|doi=10.1016/j.comtox.2020.100133|s2cid=225362130|issn=2468-1113}} and economics applications.{{Citation|title= Predicting Drug-Induced Liver Injury with Bayesian Machine Learning |year= 2020 |doi= 10.1021/acs.chemrestox.9b00264 |url= https://pubs.acs.org/doi/10.1021/acs.chemrestox.9b00264|last1= Williams |first1= Dominic P. |last2= Lazic |first2= Stanley E. |last3= Foster |first3= Alison J. |last4= Semenova |first4= Elizaveta |last5= Morgan |first5= Paul |journal= Chemical Research in Toxicology |volume= 33 |issue= 1 |pages= 239–248 |pmid= 31535850 |s2cid= 202689667 |url-access= subscription }}

Probabilistic programming in Julia has also been combined with differentiable programming by combining the Julia package Zygote.jl with Turing.jl. {{cite arXiv|date=2019|title=∂P: A Differentiable Programming System to Bridge Machine Learning and Scientific Computing|eprint=1907.07587|last1=Innes|first1=Mike|last2=Edelman|first2=Alan|last3=Fischer|first3=Keno|last4=Rackauckas|first4=Chris|last5=Saba|first5=Elliot|author6=Viral B Shah|last7=Tebbutt|first7=Will|class=cs.PL }}

Probabilistic programming languages are also commonly used in Bayesian cognitive science to develop and evaluate models of cognition. {{cite web |last1=Goodman |first1=Noah D |last2=Tenenbaum |first2=Joshua B |last3=Buchsbaum |first3=Daphna |last4=Hartshorne |first4=Joshua |last5=Hawkins |first5=Robert |last6=O'Donnell |first6=Timothy J |last7=Tessler |first7=Michael Henry |title=Probabilistic Models of Cognition |url=http://probmods.org/ |website=Probabilistic Models of Cognition - 2nd Edition |access-date=27 May 2023}}

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.{{Cite web|url=http://blog.fastforwardlabs.com/2017/01/30/the-algorithms-behind-probabilistic-programming.html|title=The Algorithms Behind Probabilistic Programming|access-date=2017-03-10}}

= 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 =

{{Main|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.{{Cite journal |last=De Raedt |first=Luc |last2=Kimmig |first2=Angelika |date=2015-07-01 |title=Probabilistic (logic) programming concepts |url=https://doi.org/10.1007/s10994-015-5494-z |journal=Machine Learning |language=en |volume=100 |issue=1 |pages=5–47 |doi=10.1007/s10994-015-5494-z |issn=1573-0565}}

= List of probabilistic programming languages =

This list summarises the variety of PPLs that are currently available, and clarifies their origins.{{Overly detailed|date=October 2019}}

class="wikitable sortable"
NameExtends fromHost language
AnalyticaC++
bayesloopPythonPython
Bean Machine|PyTorchPython
VentureSchemeC++
BayesDBSQLite, Python
PRISMB-Prolog
Infer.NET.NET Framework.NET Framework
diff-SATAnswer set programming, SAT (DIMACS CNF)
PSQLSQL
BUGSComponent Pascal
DynaProlog
FigaroScalaScala
ProbLogPrologPython
ProBTC++, Python
StanBUGSC++
HakaruHaskellHaskell
BAli-Phy (software)HaskellC++
ProbCogJava, Python
PomegranatePythonCython
InfergoGoGo
PyMCPythonPython
Rainier{{Citation|title=stripe/rainier|date=2020-08-19|url=https://github.com/stripe/rainier|publisher=Stripe|access-date=2020-08-26}}{{Cite web|title=Rainier · Bayesian inference for Scala|url=https://samplerainier.com/|access-date=2020-08-26|website=samplerainier.com}}Scala

| Scala

greta{{Cite web|url=https://greta-dev.github.io/greta/|title=greta: simple and scalable statistical modelling in R|website=GitHub|access-date=2018-10-02}}

|TensorFlow

|R

pomegranate{{Cite web|url=https://pomegranate.readthedocs.io/en/latest/index.html|title=Home — pomegranate 0.10.0 documentation|website=pomegranate.readthedocs.io|language=en|access-date=2018-10-02}}

|Python

|Python

LeaPythonPython
WebPPLJavaScriptJavaScript
Picture

| Julia

| Julia

Turing.jl

| Julia

| Julia

Gen{{Cite web|url=https://www.gen.dev/|title=Gen: A General Purpose Probabilistic Programming Language with Programmable Inference|access-date=2024-06-11}}

| Julia

| Julia

Edward{{Cite web|url=http://edwardlib.org/|title=Edward – Home|website=edwardlib.org|access-date=2017-01-17}}

|TensorFlow

|Python

TensorFlow Probability{{Cite web|url=https://medium.com/tensorflow/introducing-tensorflow-probability-dca4c304e245|title=Introducing TensorFlow Probability|last=TensorFlow|date=2018-04-11|website=TensorFlow|access-date=2018-10-02}}

|TensorFlow

|Python

Edward2{{Cite web|url=https://github.com/google/edward2|title='Edward2' TensorFlow Probability module|website=GitHub|language=en|access-date=2024-06-11}}

|TensorFlow Probability

|Python

Pyro{{Cite web|url=http://pyro.ai|title=Pyro|website=pyro.ai|language=en|access-date=2018-02-09}}

|PyTorch

|Python

NumPyro{{Cite web|url=http://num.pyro.ai/en/stable/|title=NumPyro|website=pyro.ai|language=en|access-date=2021-07-23}}

|JAX

|Python

Birch{{Cite web|url=http://birch-lang.org/|title=Probabilistic Programming in Birch|website=birch-lang.org|access-date=2018-04-20}}

|

|C++

PSI{{Cite web|url=https://psisolver.org/|title=PSI Solver - Exact inference for probabilistic programs|website=psisolver.org|access-date=2019-08-18}}

|

|D

Blang{{Cite web|url=https://www.stat.ubc.ca/~bouchard/blang/|title=Home|website=www.stat.ubc.ca}}

|

|

MultiVerse{{Citation |last1=Perov |first1=Yura |title=MultiVerse: Causal Reasoning using Importance Sampling in Probabilistic Programming |date=2020-01-28 |arxiv=1910.08091 |last2=Graham |first2=Logan |last3=Gourgoulias |first3=Kostis |last4=Richens |first4=Jonathan G. |last5=Lee |first5=Ciarán M. |last6=Baker |first6=Adam |last7=Johri |first7=Saurabh}}

|Python

|Python

Anglican{{Cite web |title=The Anglican Probabilistic Programming System |url=https://probprog.github.io/anglican/ |access-date=2024-10-07 |website=probprog.github.io}}

|Clojure

|Clojure

Difficulty

  • 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.{{Cite book|last1=Gorinova|first1=Maria I.|last2=Sarkar|first2=Advait|last3=Blackwell|first3=Alan F.|last4=Syme|first4=Don|title=Proceedings of the 2016 CHI Conference on Human Factors in Computing Systems |chapter=A Live, Multiple-Representation Probabilistic Programming Environment for Novices |date=2016-01-01|series=CHI '16|location=New York, NY, USA|publisher=ACM|pages=2533–2537|doi=10.1145/2858036.2858221|isbn=9781450333627|s2cid=3201542}}
  • 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.{{Cite web |title=pymc.find_constrained_prior — PyMC dev documentation |url=https://www.pymc.io/projects/docs/en/latest/api/generated/pymc.find_constrained_prior.html |access-date=2024-10-23 |website=www.pymc.io}}

See also

Notes

{{Reflist|30em|refs=

{{cite web|url=https://github.com/probcomp/bayeslite|title=BayesDB on SQLite. A Bayesian database table for querying the probable implications of data as easily as SQL databases query the data itself|work=GitHub|date=December 26, 2021}}

{{Cite web|url=http://bayesloop.com/|title=bayesloop - Probabilistic programming framework|website=bayesloop.com}}

{{cite web|url=https://github.com/christophmark/bayesloop|title=GitHub -- bayesloop|website=GitHub|date=December 7, 2021}}

{{cite web|url=http://www.analytica.com|title=Analytica-- A Probabilistic Modeling Language|work=lumina.com}}

{{cite web|url=http://probcomp.csail.mit.edu/venture/|title=Venture -- a general-purpose probabilistic programming platform|work=mit.edu|access-date=September 20, 2014|archive-url=https://web.archive.org/web/20160125130827/http://probcomp.csail.mit.edu/venture/|archive-date=January 25, 2016|url-status=dead}}

{{cite web|url=http://rjida.meijo-u.ac.jp/prism/|title=PRISM: PRogramming In Statistical Modeling|website=rjida.meijo-u.ac.jp|access-date=July 8, 2015|archive-url=https://web.archive.org/web/20150301155729/http://rjida.meijo-u.ac.jp/prism/|archive-date=March 1, 2015|url-status=dead}}

{{cite web|url=http://research.microsoft.com/en-us/um/cambridge/projects/infernet/|title=Infer.NET|publisher=Microsoft|work=microsoft.com}}

{{cite web|url=https://github.com/MatthiasNickles/diff-SAT/|title=diff-SAT (probabilistic SAT/ASP)|website=GitHub|date=October 8, 2021}}

{{cite journal|title=PSQL: A query language for probabilistic relational data|doi=10.1016/S0169-023X(98)00015-9 | volume=28|journal=Data & Knowledge Engineering|pages=107–120|year = 1998|last1 = Dey|first1 = Debabrata|last2=Sarkar |first2=Sumit }}

{{cite web|url=http://www.mrc-bsu.cam.ac.uk/bugs/|title=The BUGS Project - MRC Biostatistics Unit|work=cam.ac.uk|access-date=January 12, 2011|archive-url=https://web.archive.org/web/20140314080841/http://www.mrc-bsu.cam.ac.uk/bugs/|archive-date=March 14, 2014|url-status=dead}}

{{cite web|url=http://www.dyna.org/|title=Dyna|website=www.dyna.org|access-date=January 12, 2011|archive-url=https://web.archive.org/web/20160117155947/http://dyna.org/|archive-date=January 17, 2016|url-status=dead}}

{{cite web|url=http://www.cra.com/figaro|title=Charles River Analytics - Probabilistic Modeling Services|work=cra.com|date=February 9, 2017}}

{{cite web|url=http://dtai.cs.kuleuven.be/problog|title=ProbLog: Probabilistic Programming|website=dtai.cs.kuleuven.be}}

{{cite web|url=http://www.probayes.com/fr/Bayesian-Programming-Book/downloads/|title=ProbaYes - Ensemble, nous valorisations vos données|author=ProbaYes|work=probayes.com|access-date=November 26, 2013|archive-url=https://web.archive.org/web/20160305000751/http://www.probayes.com/fr/Bayesian-Programming-Book/downloads/|archive-date=March 5, 2016|url-status=dead}}

{{cite web|url=http://mc-stan.org/|archive-url=https://web.archive.org/web/20120903133321/http://mc-stan.org/|url-status=dead|archive-date=2012-09-03|title=Stan|work=mc-stan.org}}

{{cite web|url=https://hakaru-dev.github.io/|title=Hakaru Home Page|work=hakaru-dev.github.io/}}

{{cite web|url=http://www.bali-phy.org/|title=BAli-Phy Home Page|work=bali-phy.org}}

{{cite web|url=https://github.com/opcode81/ProbCog/wiki/Features|title=ProbCog|work=GitHub}}

{{cite web|url=https://docs.pymc.io/en/v3/|title=PyMC|author=PyMC devs|work=pymc-devs.github.io}}

{{cite web|url=https://bitbucket.org/piedenis/lea|title=Lea Home Page|work=bitbucket.org}}

{{cite web|url=http://dippl.org/|title=WebPPL Home Page|work=github.com/probmods/webppl}}

{{cite web|url=https://github.com/yebai/Turing.jl|title=The Turing language for probabilistic programming|website=GitHub|date=December 28, 2021}}

{{cite web|url=https://beanmachine.org|title=Bean Machine - A universal probabilistic programming language to enable fast and accurate Bayesian analysis|work=beanmachine.org}}

}}