PyMC
外觀
原作者 | PyMC開發團隊 |
---|---|
首次發布 | 2013年5月4日 |
當前版本 | 5.16.2(2024年7月11日 | )
源代碼庫 | https://github.com/pymc-devs/pymc |
編程語言 | Python |
操作系統 | 類Unix, Mac OS X, Microsoft Windows |
平台 | Intel x86 – 32-bit, x64 |
類型 | 統計包 |
許可協議 | Apache License, Version 2.0 |
網站 | www |
PyMC(曾叫做PyMC3[1])是一個Python包,用於貝葉斯統計建模和概率機器學習,它聚焦於高級馬爾可夫鏈蒙特卡洛法和變分擬合算法[2][3][4]。
概述
[編輯]PyMC曾經叫做PyMC3,不同於早先的使用Fortran擴展進行計算的PyMC2,它依靠Theano來進行自動微分、計算優化和動態C語言編譯[3][5]。從版本3.8開始PyMC依據ArviZ來進行數據可視化和貝葉斯推斷的探索分析[6]。PyMC和Stan是兩個最流行的概率編程工具[7]。
PyMC是開源項目,由社區開發並在財務上得到NumFocus贊助[8]。PyMC已經在很多領域中被用於解決推斷問題,包括天文學[9][10]、流行病學[11][12]、分子生物學[13]、晶體學[14][15]、化學[16]、生態學[17][18]和心理學[19]。
在Theano於2017年宣布計劃停止開發之後[20],PyMC團隊曾評估採用TensorFlow Probability[21]作為計算後端[22],但是在2020年接管Theano的開發[23]。在2021年1月絕大部份的Theano代碼基被重新建造,並增加了通過JAX和Numba的編譯,修訂後的這個計算後端以新名字Aesara發行。PyMC團隊在2021年6月將PyMC3更名為PyMC[1]。2022年11月28日,PyMC團隊宣布採用從Aesara計劃分叉出PyTensor[24]。
推論引擎
[編輯]PyMC實現了不基於梯度的和基於梯度的馬爾可夫鏈蒙特卡洛(MCMC)算法用於貝葉斯推斷和隨機(Stochastic),基於梯度的變分貝葉斯方法用於近似貝葉斯推斷。
- MCMC算法:
- No-U-Turn採樣(NUTS)[25],是哈密頓蒙特卡洛的變體和PyMC3用於連續變量的缺省引擎。
- 梅特羅波利斯-黑斯廷斯算法,是PyMC3用於離散變量的缺省引擎。
- 順序蒙特卡洛算法。
- 變分推斷算法:
- 黑箱變分推斷[26]。
參見
[編輯]- Stan是用C++編寫統計推論的概率編程語言。
引用
[編輯]- ^ 1.0 1.1 PyMC Timeline. PyMC Timeline. [2021-01-20]. (原始內容存檔於2018-05-20).
- ^ Salvatier J, Wiecki TV, Fonnesbeck C. (2016) Probabilistic programming in Python using PyMC3. PeerJ Computer Science 2:e55 https://doi.org/10.7717/peerj-cs.55
- ^ 3.0 3.1 Martin, Osvaldo. Bayesian Analysis with Python. Packt Publishing Ltd. 2016: 31–60 [16 September 2017]. ISBN 9781785889851 (英語).
- ^ Davidson-Pilon, Cameron. Bayesian Methods for Hackers: Probabilistic Programming and Bayesian Inference. Addison-Wesley Professional. 2015-09-30. ISBN 9780133902921 (英語).
- ^ Hilpisch, Yves. Python for Finance: Analyze Big Financial Data. O'Reilly Media, Inc. 2014-12-11. ISBN 9781491945391 (英語).
- ^ ArviZ — Exploratory analysis of Bayesian models. [2023-09-21]. (原始內容存檔於2023-10-11).
- ^ The Algorithms Behind Probabilistic Programming. [2017-03-10]. (原始內容存檔於2021-01-29).
- ^ NumFOCUS Announces New Fiscally Sponsored Project: PyMC3. NumFOCUS | Open Code = Better Science. [2017-03-10]. (原始內容存檔於2017-09-21).
- ^ Greiner, J.; Burgess, J. M.; Savchenko, V.; Yu, H.-F. On the Fermi-GBM Event 0.4 s after GW150914. The Astrophysical Journal Letters. 2016, 827 (2): L38. Bibcode:2016ApJ...827L..38G. ISSN 2041-8205. arXiv:1606.00314 . doi:10.3847/2041-8205/827/2/L38 (英語).
- ^ Hilbe, Joseph M.; Souza, Rafael S. de; Ishida, Emille E. O. Bayesian Models for Astrophysical Data: Using R, JAGS, Python, and Stan. Cambridge University Press. 2017-04-30 [2021-01-20]. ISBN 9781108210744. (原始內容存檔於2021-02-03) (英語).
- ^ Brauner, Jan M.; Mindermann, Sören; Sharma, Mrinank; Johnston, David; Salvatier, John; Gavenčiak, Tom; Stephenson, Anna B.; Leech, Gavin; Altman, George; Mikulik, Vladimir; Norman, Alexander John; Monrad, Joshua Teperowski; Besiroglu, Tamay; Ge, Hong; Hartwick, Meghan A.; Teh, Yee Whye; Chindelevitch, Leonid; Gal, Yarin; Kulveit, Jan. Inferring the effectiveness of government interventions against COVID-19. Science. 2020-12-15 [2021-01-20]. doi:10.1126/science.abd9338. (原始內容存檔於2021-02-07).
- ^ Systrom, Kevin; Vladek, Thomas; Krieger, Mike. Rt.live Github repository. Rt.live. [10 January 2021]. (原始內容存檔於2021-01-06).
- ^ Wagner, Stacey D.; Struck, Adam J.; Gupta, Riti; Farnsworth, Dylan R.; Mahady, Amy E.; Eichinger, Katy; Thornton, Charles A.; Wang, Eric T.; Berglund, J. Andrew. Dose-Dependent Regulation of Alternative Splicing by MBNL Proteins Reveals Biomarkers for Myotonic Dystrophy. PLOS Genetics. 2016-09-28, 12 (9): e1006316. ISSN 1553-7404. PMC 5082313 . PMID 27681373. doi:10.1371/journal.pgen.1006316.
- ^ Sharma, Amit; Johansson, Linda; Dunevall, Elin; Wahlgren, Weixiao Y.; Neutze, Richard; Katona, Gergely. Asymmetry in serial femtosecond crystallography data. Acta Crystallographica Section A. 2017-03-01, 73 (2): 93–101. ISSN 2053-2733. PMC 5332129 . PMID 28248658. doi:10.1107/s2053273316018696 (英語).
- ^ Katona, Gergely; Garcia-Bonete, Maria-Jose; Lundholm, Ida. Estimating the difference between structure-factor amplitudes using multivariate Bayesian inference. Acta Crystallographica Section A. 2016-05-01, 72 (3): 406–411. ISSN 2053-2733. PMC 4850660 . PMID 27126118. doi:10.1107/S2053273316003430 (英語).
- ^ Garay, Pablo G.; Martin, Osvaldo A.; Scheraga, Harold A.; Vila, Jorge A. Detection of methylation, acetylation and glycosylation of protein residues by monitoring13C chemical-shift changes: A quantum-chemical study. PeerJ. 2016-07-21, 4: e2253. ISSN 2167-8359. PMC 4963218 . PMID 27547559. doi:10.7717/peerj.2253 (英語).
- ^ Wang, Yan; Huang, Hong; Huang, Lida; Ristic, Branko. Evaluation of Bayesian source estimation methods with Prairie Grass observations and Gaussian plume model: A comparison of likelihood functions and distance measures. Atmospheric Environment. 2017, 152: 519–530. Bibcode:2017AtmEn.152..519W. doi:10.1016/j.atmosenv.2017.01.014.
- ^ MacNeil, M. Aaron; Chong-Seng, Karen M.; Pratchett, Deborah J.; Thompson, Casssandra A.; Messmer, Vanessa; Pratchett, Morgan S. Age and Growth of An Outbreaking Acanthaster cf. solaris Population within the Great Barrier Reef. Diversity. 2017-03-14, 9 (1): 18. doi:10.3390/d9010018 (英語).
- ^ Tünnermann, Jan; Scharlau, Ingrid. Peripheral Visual Cues: Their Fate in Processing and Effects on Attention and Temporal-Order Perception. Frontiers in Psychology. 2016, 7. ISSN 1664-1078. PMC 5052275 . PMID 27766086. doi:10.3389/fpsyg.2016.01442 (英語).
- ^ Lamblin, Pascal. MILA and the future of Theano. theano-users (郵件列表). 28 September 2017 [28 September 2017]. (原始內容存檔於2011-01-22).
- ^ TensorFlow Probability is a library for probabilistic reasoning and statistical analysis. [2022-08-31]. (原始內容存檔於2022-09-04).
- ^ Developers, PyMC. Theano, TensorFlow and the Future of PyMC. PyMC Developers. 2018-05-17 [2019-01-25]. (原始內容存檔於2020-08-06).
- ^ The Future of PyMC3, or: Theano is Dead, Long Live Theano. PyMC Developers. [10 January 2021]. (原始內容存檔於2021-01-15).
- ^ PyMC forked Aesara to PyTensor. [2023-08-17]. (原始內容存檔於2023-07-18).
- ^ Hoffman, Matthew D.; Gelman, Andrew. The No-U-Turn Sampler: Adaptively Setting Path Lengths in Hamiltonian Monte Carlo. Journal of Machine Learning Research. April 2014, 15: pp. 1593–1623 [2021-01-20]. (原始內容存檔於2020-08-11).
- ^ Kucukelbir, Alp; Ranganath, Rajesh; Blei, David M. Automatic Variational Inference in Stan 1506 (3431). June 2015. Bibcode:2015arXiv150603431K. arXiv:1506.03431 .
延伸閱讀
[編輯]- Probabilistic Programming and Bayesian Methods for Hackers (頁面存檔備份,存於網際網路檔案館)
- Computational Statistics in Python (頁面存檔備份,存於網際網路檔案館)
外部連結
[編輯]- PyMC web site (頁面存檔備份,存於網際網路檔案館)
- PyMC source (頁面存檔備份,存於網際網路檔案館), a Git repository hosted on GitHub
- Symbolic PyMC (頁面存檔備份,存於網際網路檔案館) is an experimental set of tools that facilitate sophisticated symbolic manipulation of PyMC models