Importance Sampling
Importance Sampling is a way to compute an expectation/integral more efficiently by sampling from a different distribution that puts more probability mass on the parts of the domain that matter the most, and then reweighing them to keep the estimator correct.
Motivation: Monte Carlo Integration
For example, consider MC Integration:
where
- where is bounded, i.e. .
- is bounded and integrable (continuous)
- is a PDF where with .
Note that and
Special Case: CMC via a Uniform Choice
More generally, any integral on can be rewritten as an expectation by introducing a PDF on :
One simple choice is the Uniform density on :
If we plug this is in,
such that
as desired.
Importance Sampling (Variance Reduction)
Instead of sampling from the “default” density, choose a proposal density on (with wherever ) and reweigh:
This gives
for and . Some remarks:
- is called the importance function
- is the likelihood ratio
Algorithm
- Generate iid.
- Set
Choosing
Pick to satisfy:
- Support: anywhere (so the weight is well-defined).
- Computable: easy to sample from.
- Low-variance weights: avoid making tiny where is large (that creates huge weights and high variance).
Variance Reduction means choosing such that
is small. The idea is to make larger when is large. Why do we want that integral small? This comes from the variance formula. Let
Then with i.i.d., so
Using :
and
Therefore
Since does not depend on , making small makes the estimator variance small.
Example 1
Consider on where and on .
By Crude MC,
the variance is
Note that
Example 2 (Using Variance Reduction)
Let’s try
This gives the estimator
for iid. So,
Then
by applying the variance formula for estimators above. What if we overdo it with a large ?
Let’s try for . being when is not ideal. What does that look like?
The estimator
with . Then
which shows it’s a bad estimator.