In these lab exercises, you work with Bayesian networks.
This exercise reviews the burglary example from the AIMA text (Figure 14.2).
Do the following exercises based on AIMA’s burglary example.
Pull network.py
and add enumeration_ask
computations for the following examples:
The numbers should make some sense given the network. Because some of the computations can get complicated, e.g., the last one, you can skip the hand-coding on these. See the text, Section 14.4.1 for a full derivation of the last one.
Store your code in lab_1.py
.
The following exercises demonstrate conditional independence using Bayesian networks that have varied topologies. The first exercise concerns a two-test cancer example.1
The Bayesian network shown on the right represents a cancer
domain in which two different cancer tests can be run and in
which
the tests are considered to be conditionally independent of one
another.
Implement this network and use it to compute the following probabilities:
Do the results make sense? How much effect does one failed test have on the probability of having cancer? Explain your answers and work them out by hand. Store your annotated code in |
![]() |
The second example concerns a two-cause happiness example.2 Here, the causes are conditionally independent as well, but their probabilities can influence one another during inference. Thrun calls this phenomenon explaining away.
The Bayesian network shown on the right represents a happiness domain in which either the sun or a raise in pay can increase the happiness of an agent.
Store your annotated code in |
![]() |
The exact inference algorithms used above tend to be intractable
in real problems, so approximation algorithms are necessary. The AIMA
probability library provides approximation algorithms to use in place of
enumeration_ask()
.
Notice the alternate computations of P(Burglary | john ∧ mary) (see 5.1 above) in the sample code, which use rejection sampling (see Figure 14.14), likelihood estimate (see Figure 14.15), and Gibbs sampling (see Figure 14.16). Do the results match those of the exact inference algorithms? Why or why not?
Add your answers for these tests to lab_1.py
created above.
We will grade your work according to the following criteria:
1 This example is taken from Thrun’s two-test cancer
example.
2 This example is taken from Thrun’s
confounding clause example.
See the policies page for lab due-dates and times.