概率編程

概率編程PPProbabilistic programming)是一種編程范型,在其中指定了概率模型並自動進行這些模型的推斷[1]。它代表了統一概率模型和傳統通用編程的一種嘗試,使前者更加容易並更廣泛的應用[2][3]。它可以用於建立系統幫助在面對不確定時作出決定。

用於概率編程的編程語言被稱為「概率編程語言」(PPL)。

應用

概率推理已經廣泛用於各種任務,比如預測股價、推薦電影、診斷計算機、檢測網絡入侵和圖像檢查[4]。但是直到最近(部份由於計算能力的限制),概率編程範圍有限,並且多數推斷算法對每個任務都必須手工編寫。

儘管如此,在2015年一個50行的概率計算機視覺程序被用於基於人臉的2D圖像來生成這些人臉的3D模型。這個程序使用反向(inverse)圖作為推斷方法的基礎,並使用Julia的Picture包來建造[4]。這使得「用50行代碼寫出過去千行代碼的程序」成為可能[5][6]。Gen概率編程庫(也用Julia寫成)已經被用於視覺和機器人任務[7]

最近,概率編程系統Turing.jl已經被用於各種製藥和經濟應用[8]。Julia中的概率編程已經結合於可微分編程,通過組合Julia包Zygote.jl和Turing.jl[9]

概率編程語言

概率編程語言(PPL)經常從基礎語言擴展而來。底層基礎語言的選擇依賴於模型與基礎語言本體的類似性,還有商業考慮和個人偏好。例如Dimple[10]和Chimple[11]基於了JavaInfer.NET英語Infer.NET基於了.NET框架[12],而PRISM擴展自Prolog[13]。但是,一些PPL比如WinBUGS英語WinBUGSStan英語Stan (software),提供了獨立的語言,沒有明顯起源自另一種語言[14][15]

一些PPL正在活躍開發中,包括在beta測試中的那些。兩個最流行的工具是Stan和PyMC[16]

關係

概率關係編程語言(PRPL)專門設計來描述和推論概率關係模型英語Statistical relational learning#Representation formalisms(PRM)的概率編程語言(PPL)。

PRM的開發通常具有一組算法,用於關注的分布的歸約、推理和發現,它們被嵌入到對應的PRPL中。

概率編程語言列表

名字 擴展自 宿主語言
Analytica英語Analytica (software)[17] C++
bayesloop[18][19] Python Python
CuPPL[20] NOVA[21]
Venture[22] Scheme C++
Probabilistic-C[23] C C
Anglican[24] Clojure Clojure
IBAL[25] OCaml
BayesDB[26] SQLite, Python
PRISM[13] B-Prolog英語B-Prolog
Infer.NET英語Infer.NET[12] .NET Framework .NET Framework
dimple[10] MATLAB, Java
chimple[11] MATLAB, Java
BLOG[27] Java
diff-SAT[28] 回答集編程, SAT (DIMACS CNF)
PSQL[29] SQL
BUGS[14] Pascal
FACTORIE[30] Scala Scala
PMTK[31] MATLAB MATLAB
Alchemy[32] C++
Dyna[33] Prolog
Figaro[34] Scala Scala
Church英語Church (programming language)[35] Scheme 各種: JavaScript, Scheme
ProbLog英語ProbLog[36] Prolog Python
ProBT[37] C++, Python
Stan英語Stan (software)[15] BUGS C++
Hakaru[38] Haskell Haskell
BAli-Phy英語BAli-Phy (軟件)[39] Haskell C++
ProbCog[40] Java, Python
Gamble[41] Racket
PWhile[42] While Python
Tuffy[43] Java
PyMC[44] Python Python
Rainier[45][46] Scala Scala
greta[47] TensorFlow R
pomegranate[48] Python Python
Lea[49] Python Python
WebPPL[50] JavaScript JavaScript
Let's Chance[51] Scratch JavaScript
Picture[4] Julia Julia
Turing.jl[52] Julia Julia
Gen[53] Julia Julia
Low-level First-order PPL[54] Python, Clojure, Pytorch 各種: Python, Clojure
Troll[55] Moscow ML
Edward[56] TensorFlow Python
TensorFlow Probability[57] TensorFlow Python
Edward2[58] TensorFlow Probability Python
Pyro[59] PyTorch Python
NumPyro[60] JAX Python
Saul[61] Scala Scala
Stan[62] C++, Python, R
RankPL[63] Java
Birch[64] C++
PSI[65] D
Blang[66]
MultiVerse[67] Python Python

困難

推理按概率分布的變量給初學編程者帶來困難,但是這些困難可以通過使用嵌入到源代碼編輯器中的變量分布的貝葉斯網絡可視化和圖來解決[68]

參見

注釋

  1. ^ Probabilistic programming does in 50 lines of code what used to take thousands. phys.org. April 13, 2015 [2015-04-13]. (原始內容存檔於2021-01-28). 
  2. ^ Probabilistic Programming. probabilistic-programming.org. [December 24, 2013]. (原始內容存檔於January 10, 2016). 
  3. ^ Pfeffer, Avrom (2014), Practical Probabilistic Programming, Manning Publications. p.28. ISBN 978-1 6172-9233-0
  4. ^ 4.0 4.1 4.2 Short probabilistic programming machine-learning code replaces complex programs for computer-vision tasks. KurzweilAI. April 13, 2015 [27 Nov 2017]. (原始內容存檔於2021-02-12). 
  5. ^ Hardesty, Larry. Graphics in reverse. April 13, 2015 [2021-01-16]. (原始內容存檔於2021-01-22). 
  6. ^ MIT shows off machine-learning script to make CREEPY HEADS. [2021-01-16]. (原始內容存檔於2019-09-20). 
  7. ^ MIT's Gen programming system flattens the learning curve for AI projects. VentureBeat. 2019-06-27 [2019-06-27]. (原始內容存檔於2021-01-24) (美國英語). 
  8. ^ Predicting Drug-Induced Liver Injury with Bayesian Machine Learning, 2019 [2021-01-16], (原始內容存檔於2020-08-06) 
  9. ^ ∂P: A Differentiable Programming System to Bridge Machine Learning and Scientific Computing, 2019, arXiv:1907.07587  
  10. ^ 10.0 10.1 Dimple Home Page. analog.com. July 2, 2021 [2021-01-16]. (原始內容存檔於2020-10-14). 
  11. ^ 11.0 11.1 Chimple Home Page. analog.com. April 16, 2021 [2021-01-16]. (原始內容存檔於2020-11-07). 
  12. ^ 12.0 12.1 Infer.NET. microsoft.com. Microsoft. [2021-01-16]. (原始內容存檔於2016-12-06). 
  13. ^ 13.0 13.1 PRISM: PRogramming In Statistical Modeling. rjida.meijo-u.ac.jp. [July 8, 2015]. (原始內容存檔於March 1, 2015). 
  14. ^ 14.0 14.1 The BUGS Project - MRC Biostatistics Unit. cam.ac.uk. [January 12, 2011]. (原始內容存檔於March 14, 2014). 
  15. ^ 15.0 15.1 Stan. mc-stan.org. (原始內容存檔於2012-09-03). 
  16. ^ The Algorithms Behind Probabilistic Programming. [2017-03-10]. (原始內容存檔於2021-01-29). 
  17. ^ Analytica-- A Probabilistic Modeling Language. lumina.com. [2021-01-16]. (原始內容存檔於2021-01-28). 
  18. ^ bayesloop: Probabilistic programming framework that facilitates objective model selection for time-varying parameter models. [2021-01-16]. (原始內容存檔於2020-12-01). 
  19. ^ GitHub -- bayesloop. GitHub. December 7, 2021 [2021-01-16]. (原始內容存檔於2020-09-28). 
  20. ^ Probabilistic Programming with CuPPL. popl19.sigplan.org. [2021-01-16]. (原始內容存檔於2019-01-21). 
  21. ^ NOVA: A Functional Language for Data Parallelism. acm.org. Array'14. June 9, 2014: 8–13. ISBN 9781450329378. S2CID 6748967. doi:10.1145/2627373.2627375. 
  22. ^ Venture -- a general-purpose probabilistic programming platform. mit.edu. [September 20, 2014]. (原始內容存檔於January 25, 2016). 
  23. ^ Probabilistic C. ox.ac.uk. [March 24, 2015]. (原始內容存檔於January 4, 2016). 
  24. ^ The Anglican Probabilistic Programming System. ox.ac.uk. January 6, 2021 [2021-01-16]. (原始內容存檔於2020-10-26). 
  25. ^ IBAL Home Page. (原始內容存檔於December 26, 2010). 
  26. ^ 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 [2021-01-16]. (原始內容存檔於2020-09-21). 
  27. ^ Bayesian Logic (BLOG). mit.edu. (原始內容存檔於June 16, 2011). 
  28. ^ diff-SAT (probabilistic SAT/ASP). GitHub. October 8, 2021 [2022-08-31]. (原始內容存檔於2023-04-25). 
  29. ^ Dey, Debabrata; Sarkar, Sumit. PSQL: A query language for probabilistic relational data. Data & Knowledge Engineering. 1998, 28: 107–120. doi:10.1016/S0169-023X(98)00015-9. 
  30. ^ Factorie - Probabilistic programming with imperatively-defined factor graphs - Google Project Hosting. google.com. [2021-01-16]. (原始內容存檔於2012-04-14). 
  31. ^ PMTK3 - probabilistic modeling toolkit for Matlab/Octave, version 3 - Google Project Hosting. google.com. [2021-01-16]. (原始內容存檔於2011-04-10). 
  32. ^ Alchemy - Open Source AI. washington.edu. [2021-01-16]. (原始內容存檔於2008-06-16). 
  33. ^ Dyna. www.dyna.org. [January 12, 2011]. (原始內容存檔於January 17, 2016). 
  34. ^ Charles River Analytics - Probabilistic Modeling Services. cra.com. February 9, 2017. 
  35. ^ Church. mit.edu. [April 8, 2013]. (原始內容存檔於January 14, 2016). 
  36. ^ ProbLog: Probabilistic Programming. dtai.cs.kuleuven.be. [2021-01-16]. (原始內容存檔於2020-11-08). 
  37. ^ ProbaYes. ProbaYes - Ensemble, nous valorisations vos données. probayes.com. [November 26, 2013]. (原始內容存檔於March 5, 2016). 
  38. ^ Hakaru Home Page. hakaru-dev.github.io/. [2021-01-16]. (原始內容存檔於2020-11-08). 
  39. ^ BAli-Phy Home Page. bali-phy.org. [2021-01-16]. (原始內容存檔於2021-03-22). 
  40. ^ ProbCog. GitHub. [2021-01-16]. (原始內容存檔於2020-11-29). 
  41. ^ Culpepper, Ryan. gamble: Probabilistic Programming. January 17, 2017 [2021-01-16]. (原始內容存檔於2020-11-06) –透過GitHub. 
  42. ^ PWhile Compiler. GitHub. May 25, 2020 [2021-01-16]. (原始內容存檔於2020-10-17). 
  43. ^ Tuffy: A Scalable Markov Logic Inference Engine. stanford.edu. [2021-01-16]. (原始內容存檔於2020-07-22). 
  44. ^ PyMC devs. PyMC. pymc-devs.github.io. [2022-08-31]. (原始內容存檔於2022-05-16). 
  45. ^ stripe/rainier, Stripe, 2020-08-19 [2020-08-26], (原始內容存檔於2021-02-19) 
  46. ^ Rainier · Bayesian inference for Scala. samplerainier.com. [2020-08-26]. [失效連結]
  47. ^ greta: simple and scalable statistical modelling in R. GitHub. [2018-10-02]. (原始內容存檔於2018-10-03). 
  48. ^ Home — pomegranate 0.10.0 documentation. pomegranate.readthedocs.io. [2018-10-02]. (原始內容存檔於2021-01-22) (英語). 
  49. ^ Lea Home Page. bitbucket.org. [2021-01-16]. (原始內容存檔於2021-01-21). 
  50. ^ WebPPL Home Page. github.com/probmods/webppl. [2021-01-16]. (原始內容存檔於2020-12-29). 
  51. ^ Let's Chance: Playful Probabilistic Programming for Children | Extended Abstracts of the 2020 CHI Conference on Human Factors in Computing Systems. dl.acm.org. Chi Ea '20. April 25, 2020: 1–7 [2020-08-01]. ISBN 9781450368193. S2CID 216079395. doi:10.1145/3334480.3383071. (原始內容存檔於2021-01-22) (英語). 
  52. ^ The Turing language for probabilistic programming. GitHub. December 28, 2021. 
  53. ^ Gen: A General Purpose Probabilistic Programming Language with Programmable Inference. [2019-06-17]. (原始內容存檔於2020-11-12). 
  54. ^ LF-PPL: A Low-Level First Order Probabilistic Programming Language for Non-Differentiable Models. ox.ac.uk. November 2, 2019. 
  55. ^ Troll dice roller and probability calculator. [2021-01-16]. (原始內容存檔於2021-01-25). 
  56. ^ Edward – Home. edwardlib.org. [2017-01-17]. (原始內容存檔於2020-11-08). 
  57. ^ TensorFlow. Introducing TensorFlow Probability. TensorFlow. 2018-04-11 [2018-10-02]. (原始內容存檔於2021-01-22). 
  58. ^ 'Edward2' TensorFlow Probability module. GitHub. [2018-10-02]. (原始內容存檔於2020-01-08) (英語). 
  59. ^ Pyro. pyro.ai. [2018-02-09]. (原始內容存檔於2021-01-19) (英語). 
  60. ^ NumPyro. pyro.ai. [2021-07-23]. (原始內容存檔於2022-10-31) (英語). 
  61. ^ CogComp - Home. [2021-01-16]. (原始內容存檔於2018-01-16). 
  62. ^ Stan is a state-of-the-art platform for statistical modeling and high-performance statistical computation. [2021-01-16]. (原始內容存檔於2021-04-02). 
  63. ^ Rienstra, Tjitze, RankPL: A qualitative probabilistic programming language based on ranking theory, 2018-01-18 [2018-01-18], (原始內容存檔於2020-11-09) 
  64. ^ Probabilistic Programming in Birch. birch-lang.org. [2018-04-20]. (原始內容存檔於2021-01-29). 
  65. ^ PSI Solver - Exact inference for probabilistic programs. psisolver.org. [2019-08-18]. (原始內容存檔於2021-01-23). 
  66. ^ Blang Homepage. [2022-08-31]. (原始內容存檔於2021-05-10). 
  67. ^ Perov, Yura; Graham, Logan; Gourgoulias, Kostis; Richens, Jonathan G.; Lee, Ciarán M.; Baker, Adam; Johri, Saurabh, MultiVerse: Causal Reasoning using Importance Sampling in Probabilistic Programming, 2020-01-28, arXiv:1910.08091  
  68. ^ Gorinova, Maria I.; Sarkar, Advait; Blackwell, Alan F.; Syme, Don. 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). 2016-01-01: 2533–2537. ISBN 9781450333627. doi:10.1145/2858036.2858221. 

外部連結