An accept/reject algorithm filters proposed moves. In Metropolis–Hastings, it compares the proposed point’s posterior density with the current point’s density, accepting the move with probability min(1, r); otherwise, it stays put. section 5.6 section 5.7
A Metropolis–Hastings iteration follows this short sequence:
- Start at a current point in the hypothesis space. section 5.6
- Draw a nearby proposal from a Normal distribution centered at the current point. section 5.6
- Compute r as proposed posterior density divided by current posterior density, using unnormalized densities when necessary. section 5.6
- Accept the proposal according to that probability; rejection records the current point again. section 5.6
A small sampling loop
A Python implementation stores an initial value, proposes Normal steps, evaluates an unnormalized posterior, calculates r, and either records the proposal or repeats the previous sample. Repeated filtering keeps samples concentrated in high-density regions while still allowing exploration elsewhere. section 5.7

