Registry Synced

Importance Sampling and Variance Reduction

105 words
1 min read

Reading compass

Now · Importance Sampling

Importance Sampling and Variance Reduction

Importance Sampling

Estimate Ef[h(X)]E_f[h(X)] by sampling from g(x)g(x) instead of f(x)f(x):
θ^=1n∑i=1nh(Xi)f(Xi)g(Xi)\hat{\theta} = \frac{1}{n} \sum_{i=1}^n h(X_i) \frac{f(X_i)}{g(X_i)}

Control Variates

If E[U]=μUE[U] = \mu_U known, use YCV=Y−β(U−μU)Y_{CV} = Y - \beta(U - \mu_U). Optimal β=Cov(Y,U)/Var(U)\beta = \text{Cov}(Y, U) / \text{Var}(U).
python
import numpy as np
# Control variate: use known mean of U
u = np.random.uniform(0, 1, 1000)
y = np.exp(u)  # want to estimate integral of e^x
u_mean = 0.5
beta = np.cov(y, u)[0,1] / np.var(u)
y_cv = y - beta * (u - u_mean)
print(f"Var(Y): {np.var(y):.4f}, Var(Y_CV): {np.var(y_cv):.4f}")
Document outline

Keep your place and jump directly to a heading.

Table of contents

No note selected

Open a chapter to see its outline, backlinks, and sources here.