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

Forward sampling


The simplest approach to the generation of particles is forward sampling. In the case of forward sampling, we generate random samples , , …, from the distribution P(X).

Let's take the example of generating particles using our restaurant model:

Fig 4.18: Restaurant model

We start by simply selecting a state of the variable Location with the probabilities 0.6 and 0.4. Let's say we select the location of the restaurant to be good and select the quality to be good as well. Now, knowing the observed states of Location and Quality, we can now select the state of Cost to be high with the probability 0.8 and low with the probability 0.2. Similarly, selecting a state for No. of People, we will get a single full particle over our restaurant model. To generate M particles, we repeat the same process M times to get M instantiations of the variables.

The main thing to notice is that we start with sampling variables that have no parents, and do it in an order such that before we sample any...