MH proposes a move, accepts proportional to density ratio. Builds a correlated chain that converges to the target.
Sampling Methods - Interactive Visualization
When a distribution is too complex to sample from directly, we use MCMC methods. Rejection sampling proposes from a simple distribution and accepts with probability p(x)/M·q(x). Importance sampling reweights proposals. Metropolis-Hastings uses a random walk that explores the target distribution. This visualization animates all three on the same target distribution, showing acceptance rates and how samples build up.
Watch rejection sampling propose and accept/reject in real time
See importance sampling weights shown as dot sizes
Watch Metropolis-Hastings random walk explore the target
Compare acceptance rates between methods
See trace plots showing the chain of accepted samples over time
Part of the EngineersOfAI Interactive 3D - free interactive visualizations covering every major concept in machine learning and AI engineering. Hover any element for a plain-English explanation. No code required.