Bayesian Machine Learning · Markov chain Monte CarloThe Metropolis algorithm
Metropolis on Two Humps
The target p(θ) = ½ N(θ; −1, 0.5²) + ½ N(θ; 1, 0.5²) has two humps. We can compute p(θ) anywhere, but we can't sample from it.
Start somewhere; propose θp from q(θ; θc) = N(θc, σ²); move with probability
pmove = min(1, p(θp) / p(θc)), otherwise stay. Where the walk has been is the sample, and the width σ is the knob.
Ready
1 · Targetp(θ), two humps2 · Proposal3 · Samples ≈ p(θ)Where the walk has beenTarget p(θ)