Likelihood weighting and importance sampling

In the previous section, we saw that the rejection method was very expensive because we were generating particles that were not consistent with our evidence, and then ultimately rejecting them. So, one possible solution to this problem is to generate particles that are more relevant to our event. We will be exploring this solution in this section.

To make the samples relevant to our evidence, we can force the sampling method to only take those values that we have observed. Taking the example of our restaurant model, let's say that we have observed that the location is good. Then, every time when generating a sample, we will only select the Location variable to be good. In this way, we can have observations ...

Get Mastering Probabilistic Graphical Models Using Python 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.