Skip to content

Latest commit

 

History

History
41 lines (27 loc) · 2.05 KB

importance_sampling.rst

File metadata and controls

41 lines (27 loc) · 2.05 KB

ImportanceSampling

Importance sampling (IS) is based on the idea of sampling from an alternate distribution and reweighting the samples to be representative of the target distribution (perhaps concentrating sampling in certain regions of the input space that are of greater importance). This often enables efficient evaluations of expectations Ex ∼ p[f(x)] where f(x) is small outside of a small region of the input space. To this end, a sample x is drawn from a proposal distribution q(x) and re-weighted to correct for the discrepancy between the sampling distribution q and the true distribution p. The weight of the sample is computed as

$$w(\textbf{x}) = \frac{p(\textbf{x})}{q(\textbf{x})}$$

If p is only known up to a constant, i.e., one can only evaluate (x), where $p(\textbf{x})=\frac{\tilde{p}(\textbf{x})}{Z}$, IS can be used by further normalizing the weights (self-normalized IS). The following figure shows the weighted samples obtained when using IS to estimate a 2D Gaussian target distribution p, sampling from a uniform proposal distribution q.

IS weighted samples

ImportanceSampling Class

The .ImportanceSampling class is imported using the following command:

>>> from UQpy.sampling.ImportanceSampling import ImportanceSampling

Methods

UQpy.sampling.ImportanceSampling

Attributes

UQpy.sampling.ImportanceSampling.samples

UQpy.sampling.ImportanceSampling.unnormalized_log_weights

UQpy.sampling.ImportanceSampling.weights

UQpy.sampling.ImportanceSampling.unweighted_samples

Examples

Importance Sampling Examples <../auto_examples/sampling/importance_sampling/index>