foundations of computational agents
The third edition of Artificial Intelligence: foundations of computational agents, Cambridge University Press, 2023 is now available (including full text).
Given some evidence , rejection sampling estimates using the formula
This is computed by considering only the samples where is true and by determining the proportion of these in which is true. The idea of rejection sampling is that samples are generated as before, but any sample where is false is rejected. The proportion of the remaining, non-rejected, samples where is true is an estimate of . If the evidence is a conjunction of assignments of values to variables, a sample is rejected when any variable is assigned a value different from its observed value.
Sample | Tampering | Fire | Alarm | Smoke | Leaving | Report | |
---|---|---|---|---|---|---|---|
✘ | |||||||
✔ | |||||||
✘ | |||||||
✔ | |||||||
✘ | |||||||
✔ | |||||||
✘ | |||||||
✘ | |||||||
… | |||||||
✘ |
Figure 8.29 shows how rejection sampling is used to estimate . Any sample with is rejected. The sample is rejected without considering any more variables. Any sample with is rejected. The sample average from the remaining samples (those marked with ✔) is used to estimate the posterior probability of .
Because , we would expect about 13 samples out of the 1000 to have true; the other 987 samples would have false, and so would be rejected. Thus, 13 is used as in Hoeffding’s inequality, which, for example, guarantees an error for any probability computed from these samples of less than in about 86% of the cases, which is not very accurate.
The error in the probability of depends on the number of samples that are not rejected, which proportional to . Hoeffding’s inequality can be used to estimate the error of rejection sampling, where is the number of non-rejected samples. Therefore, the error depends on .
Rejection sampling does not work well when the evidence is unlikely. This may not seem like that much of a problem because, by definition, unlikely evidence is unlikely to occur. But, although this may be true for simple models, for complicated models with complex observations, every possible observation may be unlikely. Also, for many applications, such as in diagnosis, the user is interested in determining the probabilities because unusual observations are involved.