Inference engines

While conceptually simple, Bayesian methods can be mathematically and numerically challenging. The main reason is that the marginal likelihood, the denominator in Bayes' theorem (see equation 1.4), usually takes the form of an intractable or computationally-expensive integral to solve. For this reason, the posterior is usually estimated numerically using algorithms from the Markov Chain Monte Carlo (MCMC) family or, more recently, variational algorithms. These methods are sometimes called inference engines, because, at least in principle, they are capable of approximating the posterior distribution for any probabilistic model. Even when in practice inference does not always work that well, the existence of such methods has motivated the development of probabilistic programming languages such as PyMC3.

The goal of probabilistic programming languages is to separate the model-building process from the inference process to facilitate the iterative steps of model building, evaluation, and model modification/expansion (as discussed in Chapter 1Thinking Probabilistically, and Chapter 2Programming Probabilistically). By treating the inference process (but not the model building process) as a black box, users of probabilistic programming languages such as PyMC3 are free to focus on their specific problems, leaving PyMC3 to handle the computational details for them. This is exactly what we have being doing up to this point. So, you may be biased to think that this is the obvious or natural approach. But it is important to notice that before probabilistic programming languages, people doing probabilistic models were also used to writing their own sampling methods, generally tailored to their models, or they were used to simplifying their models to make them suitable for certain mathematical approximations. In fact, this is still true in some academic circles. This tailored approach can be more elegant and can even provide a more efficient way of computing a posterior, but it is also error-prone and time-consuming, even for experts. Furthermore, the tailored approach is not suitable for most practitioners interested in solving problems with probabilistic models. Software like PyMC3 invites people from a very broad background to work with probabilistic models, lowering the mathematical and computational entry barrier. I personally think this is fantastic and also an invitation to learn more about good practices in statistical modeling so we try to avoid fooling ourselves . The previous chapters have been mostly about learning the basics of Bayesian modeling; now we are going to learn, at a conceptual level, how automatic inference is achieved, when and why it fails, and what to do when it fails.

There are several methods to numerically compute the posterior. I have ordered them into two broad groups:

  • Non-Markovian methods
    • Grid computing
    • Quadratic approximation
    • Variational methods
  • Markovian methods
    • Metropolis-Hastings
    • Hamiltonian Monte Carlo
    • Sequential Monte Carlo
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.97.202