Back to AI Math Mind Map
中文·English
📐 AI MathID: rejection-sampling

Rejection Sampling

拒绝采样
🎯Core Definition
Rejection Sampling generates samples that are exactly distributed as the target p(x)p(x) when direct sampling is hard: pick an easy-to-sample proposal q(x)q(x) and a constant MM with p(x)Mq(x)p(x) \le M q(x) for all xx (envelope condition). Loop: draw XqX \sim q, then UUniform(0,1)U \sim \text{Uniform}(0, 1); accept XX if Up(X)/(Mq(X))U \le p(X)/(M q(X)), otherwise retry. Acceptance probability:
📌Overview
P(accept)=q(x)p(x)Mq(x)dx=1M,P(\text{accept}) = \int q(x) \cdot \frac{p(x)}{M q(x)} \, dx = \frac{1}{M},
📌Overview
where q(x)q(x) is the density of XX at xx and the factor in parentheses is the conditional acceptance probability at xx; the expected number of trials is exactly MM — tighter envelopes (MM close to 1) are more efficient, and the result is independent of the normalization constant of pp (any constant factor is absorbed into the envelope).
💡Use Cases
targets known only up to a constant (e.g. Bayesian posteriors \propto prior ×\times likelihood) in low dimension; interviews often ask for the acceptance-rate derivation and "why it fails in high dimensions".
Key Problems Solved
exact samples without inverting a CDF or normalizing the target — the simplest general exact sampler; but the acceptance rate 1/M1/M decays exponentially with dimension dd (McdM \propto c^d) because of volume concentration, so nearly all proposals are rejected and one must switch to MCMC or importance sampling.
🎯5 High-Frequency Exam Points
1
Derive the acceptance probability P(accept)=1/MP(\text{accept}) = 1/M; why is it independent of the normalization constant of pp?
2
Full algorithm of rejection sampling? How does the expected number of trials relate to MM?
3
Why does rejection sampling fail in high dimensions (volume concentration, exponentially growing envelope)?
4
How to choose a good proposal qq and constant MM? What does a loose envelope cost?
5
Can rejection sampling handle unnormalized pp? How is the constant factor absorbed?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Rejection Sampling"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardInverse Transform SamplingNext CardImportance Sampling

🔗 More AI Math Knowledge Cards

Adam/AdamW MathBayesian InferenceBias-Variance DecompositionBootstrap