Bayesian Modeling and Computation in Python

Summary posted by: Reshama Shaikh

Using Python for Bayesian Analysis

  • PyMC is 100% pure Python code
  • PyMC is open source
  • PyMC is fast because it is built on top of Theano, a python library for fast numerical computation
  • Since PyMC is written in Python, we can use the same syntax for other steps, such as: plotting, data input, outputting, and writing a model
  • Interoperability with the rest of the Python ecosystem where it’s really just a library and not a framework, including deployability
  • PyMC can be compiled with JAX, which is a new compute library from Google


Given how popular Python is and how Bayesian methods are being more widely used, it makes sense that PyMC, a probabilistic programming language, is gaining in popularity.

In this presentation, a PyMC developer gives an overview of PyMC and why you should supercharge your data science skills with probabilistic programming. The talk is organized by layers from more generic to more specific. We will cover the main features of the Bayesian paradigm, then probabilistic progamming, then PyMC and we will finish covering some hands on examples of Bayesian modeling with PyMC.



These are some of the topics covered in this presentation.

  • 00:00 Reshama introduces Data Umbrella
  • 06:55 Oriol begins presentation
  • 07:50 Bayesian Paradigm (Data is considered once fixed it has been observed; Model parameters are treated as random)
  • 11:20 Prior information (prior distribution)
  • 12:30 Uncertainty
  • 13:55 Probabilistic programming
  • 14:42 Generative modeling
  • 14:48 Automagical solvers
  • 15:55 Inference algorithms (MCMC: HMC + NUTS, Metropolis, Gibbs); Variational inference: ADVI
  • 16:55 PyMC3
  • 17:58 PyMC version 4 is built on top of Aesara, whch is built on top of Theano
  • 19:30 PyMC is extensible
  • 20:30 PyMC is open source and community-driven
  • 23:45 PyMC in practice
  • 23:50 Example 1: Coal mining disasters
  • 30:00 Example 2: Housing prices in Berlin
  • 36:30 Acknowledgments
  • 38:15 Resources, where to go next
  • 40:45 python code example
  • 43:45 Oriol’s journey in open source and statistics; was a Google Summer of Code scholar

More Resources on: Bayesian Modeling and Computation in Python

For more information and resources, check out our series of videos on probabilistic programming and PyMC playlist by PyMC library team members: