Book Image

Mastering Probabilistic Graphical Models with Python

By : Ankur Ankan
Book Image

Mastering Probabilistic Graphical Models with Python

By: Ankur Ankan

Overview of this book

Table of Contents (14 chapters)
Mastering Probabilistic Graphical Models Using Python
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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 that are consistent with our evidence, but this method leads to another problem. Let's say that we have observed that Cost is high, so when we generate samples forcing Cost to be high, we will still have the probability of Location to be good...