Venturecxx icon indicating copy to clipboard operation
Venturecxx copied to clipboard

Quadrature Gibbs

Open axch opened this issue 8 years ago • 0 comments

There is a generic way to sample exactly from the local posterior of a 1-D continuous-valued variable. To wit:

  • Numerically integrate said local posterior from -inf to +inf to compute the normalization constant;
  • Form the cumulative distribution function for that variable as the antiderivative of the normalized probability density function;
  • Form the inverse-cdf as a numerical inversion of the (helpfully monotonic) cdf; and
  • Sample from the distribution as inverse-cdf(uniform(0, 1)).

The task of implementing this method generically is technically interesting for several reasons:

  • Since the local priors and likelihoods are arbitrary, one needs to use a numerically robust integration technique. I am told that tanh-sinh quadrature is a good place to look.
  • It is interesting software arrangement to reuse pdf evaluations between the initial integration and each step of the cdf inversion. This is important to do because without such reuse, the method may evaluate the local posterior density asymptotically too many times.
  • Some care is necessary to handle priors or likelihoods whose domains are not the whole real line. For inspiration, Venture's slice sampling implements a solution to the same problem.
  • There may be an extension to more than one dimension -- quadrature should beat Monte Carlo in up to 3-D.

The effect of implementing this method generically would be useful because it's always good to have ways of getting samples that are guaranteed to be exact. The other generic methods that can be applied to 1-D problems are:

  • Rejection sampling, which may be faster or (much) slower depending on the K-L difference between the prior and the posterior.
  • Resimulation M-H, which is not exact (except in trivial cases), whose convergence is hard to diagnose, and may be hopelessly slow in similar situations as rejection.
  • Random-walk M-H, which is still annoying to get in VentureScript, depends on parameters, is not exact, and is hard to diagnose convergence.
  • Slice sampling, which is not exact, is hard to diagnose for convergence, and, depending on parameters, may actually require far more evaluations of the local posterior.
  • The so-called Griddy Gibbs, which is the most similar of these to the proposed quadrature Gibbs, but is also not implemented in Venture, and may not be sound (unless the grid is randomized with some clever auxiliary variable argument I don't know about?). Also likely to cost a comparable number of posterior evaluations per sample.

axch avatar Jun 06 '16 22:06 axch