Adapted from an appendix of my MS thesis.
Non-centered Parameterization
For relatively simple models, samplers mostly just work, providing us with an accurate estimate of the posterior. However, certain posterior geometries are challenging for samplers. A common example is Neal’s funnel. The shape at the top of the funnel is quite wide before narrowing into a small neck. Samplers function by taking steps from one set of parameter values to another, and a key setting is how large of a step to take when exploring the posterior surface. In complex geometries, such as with Neal’s funnel, a step size that works well in one area fails in another [1].
In hierarchical models the posterior geometry is largely defined by the correlation of hyperpriors to other parameters, which can result in funnel geometry that are difficult to sample. These inconvenient posteriors can create inefficient MCMC caused by steep curvature in the negative log-likelihood and lead to divergent transitions. Transforming the prior to be smoother helps. There is a relatively simple tweak to models, referred to as a non-centered parameterization, that helps alleviate the issue [1].
Example: Devil’s Funnel prior
As increases, a trough forms in the prior probability surface known as centered parameterization that is difficult for Hamiltonian dynamics to sample [2, 3].
To handle this, we could configure a smaller steps size to manage the steepness better, but then sampling would take longer to explore the posterior. Alternatively, we can re-parameterize (transform) to make the surface smoother known non-centered parameterization. For this purpose, we add an auxiliary variable that has a smooth probability surface. We then sample that auxiliary variable, and transform it to obtain the target variable distribution. For the case of the devil’s funnel prior we do the following [2, 3].
We can also transform sampling using Cholesky factors. The Cholesky factor provides an efficient means for encoding a correlation matrix since it requires fewer floating point numbers than the full correlation matrix. It is defined by where is a lower-triangular matrix. We can sample data with correlation , and standard deviation , using the Cholesky factorization of as follows where is a matrix of -scores sampled from a standard normal distribution [2, 3].
References
- Martin, Osvaldo A., Kumar, Ravin, Lao, Junpeng (2021) Bayesian Modeling and Computation in Python. Chapman and Hall/CRC.
- McElreath, Richard (2020) Statistical Rethinking: A Bayesian Course with Examples in R and STAN. Chapman and Hall/CRC.
- Dustin Stansbury, Richard McElreath (2024) Correlated Features. Zenodo.
![An example of Neal’s Funnel created from correlated samples. At the top of the funnel, where katex inline y endkatex is between 6 to 8, a step size of say 1 unit is likely to stay in a dense region of the posterior. However, when sampling at the bottom of the posterior, around katex inline y endkatex between -6 to -8, a step size of 1 unit in almost any direction will likely step into a low-density region. For HMC samplers, the occurrence of divergences can diagnose these sampling issues [1].](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6bhtu5r7d6idh1cyo1gy.png)
![Centered parameterization [2, 3].](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq7myq4pdoo3oz2t6dyit.png)
![Centered parameterization [2, 3].](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuqoqefncrfjw2bt0r80k.png)
![Centered parameterization [2, 3].](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe05fczp9rsi4gpgn80nj.png)
![Non-centered parameterization [2, 3].](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh9zy5bicv8pvmje62w78.png)
![Non-centered parameterization [2, 3].](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flmzaq94ijwbljrdzqhcw.png)
![Non-centered parameterization [2, 3].](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6evfsihbamzfmuskrg87.png)
Top comments (0)