Skip to main content
Interactive 3D/Sampling Methods
Sampler
Target Distribution
μ₁ (first mode)-1.50
μ₂ (second mode)1.80
w₁ (weight)0.40
Step Controls
Metrics
Total attempts0
Accepted0
Acceptance rate0.0%
ESS0
Legend
Accepted sample
Rejected sample
Target p(x)
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.