Forward sampling

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

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

Forward sampling

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 variable, we already have the values for all the parents of that variable.

After generating some particles, we can estimate the expectation of some function f using these particles as follows:

Forward sampling

Now, for a case when we want to compute the probability of some event Y = y, using these particles, we can simply calculate the fraction of particles satisfying the event. So, we can compute the probability P(Y = y) as follows:

Forward sampling

So, taking the example of our restaurant model and computing the probability of Cost to be high, Forward sampling of the restaurant is equivalent to getting the fraction of particles satisfying these values:

Forward sampling

The key points to note in the case of particle methods are as follows:

  • The result of the inference using sampling highly depends on the number of particles that we used for inference. It is quite possible that generating a very small number of samples will not represent our original distribution at all, and will thus give very inaccurate results.
  • We can use the same particles to answer multiple queries, and therefore, sampling methods are very effective when we need to query the model multiple times.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset