Importance sampling

Importance sampling is an improvement on rejection sampling. Again the assumptions are the same and we will use a proposal distribution q(x). We also assume that we can compute the value of the density of probability p(x). But we are unable to draw a sample from it because it is, again, too complex.

Importance sampling is based on the following reasoning, where we need to evaluate the expectation of a function f(x) with respect to the distribution p(x):

Importance sampling

At this stage, we simply introduce the distribution q(x) in the previous expression:

And, as before, we approximate it with a finite sum:

The ratio is called importance weight and ...

Get Learning Probabilistic Graphical Models in R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.