Summary
Monte Carlo estimates an expectation by averaging sampled contributions; importance sampling changes the sampling law and corrects those contributions. The proposal must cover the relevant target contribution, and useful uncertainty calculations require suitable moment and dependence conditions. Normalized weights, unbiased expectations, and diagnostic effective sample size are different objects.
Plain Monte Carlo
For iid and integrable f, is unbiased. If contribution variance is finite, and the iid CLT supports asymptotic normal approximations. The standard-error rate does not remove dimension-dependent variance constants or guarantee superiority over deterministic integration.
Let outcomes be zero and one, target , and . Then target mean is one and direct-sampling contribution variance is .
Importance sampling
For iid proposal draws from q and known normalized p, use:
Choose for the fixture.
Weights become and corrected contributions , each appearing with probability one-half.
Their mean remains one but variance becomes .
Draws [0,1,0,1] give ordinary estimate one; exact four-draw estimator variance is , versus under direct sampling.
This particular proposal improves variance; other proposals can worsen it or give infinite variance.
Require q positive wherever contributes, and integrability of the weighted contribution.
Proposal (1,0) misses the nonzero contribution entirely: every estimate is zero although the target mean is one.
Lose the Target Normalizing Constant
New task: Evaluate only .
Picture and change: Use self-normalized estimate so the common factor cancels. This requires target coverage and a positive denominator, plus appropriate convergence conditions.
Check: The four fixture weights are ; numerator and denominator both equal twelve. Dividing only that numerator by four gives three, not the desired expectation one.
Use when: The target density is known only up to a common factor. The ratio is generally finite-sample biased, although consistent under suitable conditions.
Move Proposal Mass toward the Integrand
New task: Replace q with , keeping p and f fixed.
Picture and change: Recompute weights as and corrected contributions as .
Check: Contribution mean is still one and variance is . Old proposal weights cannot be reused.
Use when: Proposal draws can concentrate where the integrand contributes; validate coverage and weighted moments rather than weights alone.
Effective sample size
A diagnostic of nonnegative-weight concentration is:
For illustrative weights [1,1,1,1,6], normalized shares are and ESS is .
These are sample weight shares, not each sample’s fraction of a general estimate, which also depends on f.
Importance weights
Five draws remain five draws even when unequal weights yield ESS 2.5
Derivation
Does enlarging the first draw create another independent observation?
Equal weights give ESS n; one dominating weight pushes it toward one. This diagnostic cannot reveal missing support, guarantee error bars, or replace weighted-integrand variance checks. It is distinct from autocorrelation-based ESS for dependent Monte Carlo chains.
Where it shows up in ML
| Use case | What’s the integral |
|---|---|
| REINFORCE policy gradient | |
| Variational inference (ELBO gradient via reparam alternatives) | |
| Off-policy RL (importance sampling correction) | |
| Bayesian posterior predictive | |
| Importance-weighted autoencoders (IWAE) | tighter ELBO via -sample IS |
Variance reduction
- Control variates: subtract while preserving expectation; select c and account for its estimation.
- Antithetic variates: preserve each sample’s marginal law; benefit requires suitable negative contribution covariance.
- Stratification: sample strata and combine with target mass weights, not an arbitrary unweighted average.
- Rao-Blackwellization: conditional expectations reduce variance when their required moments exist.
Common pitfalls
- Heavy tails: finite target expectation does not imply finite weighted-contribution variance.
- Changing proposals: reuse requires the correct proposal accounting; trajectory likelihood ratios need their specified sequential factorization.
- False normal coverage: is an asymptotic iid approximation under suitable moments, not universal finite-sample coverage.
- Finite-sample bias: with one draw, self-normalization returns f(X), whose q-expectation need not match the p-expectation.