729G78 Artificiell intelligens
Laboration 5: Probabilistisk logik
Purpose
The purpose of this lab is to provide you with some experience and understanding of modelling and interpreting Bayesian Networks. You will acquire hands-on experience with a tool for constructing probabilistic models.
Preparation
In preparation for this lab you should:
- Read chapter 13.1-5 and 14.1-4 in the course book before doing this lab. You should have an understanding of what Bayesian Networks are, how they are constructed, and their theoretical underpinnings..
- The software that you will use during the lab is called "Bayes Applet". Look at tutorials at
http://aispace.org/bayes/. Download bayes.jar from the course library. To start
the program, double-click the jar-file or run it from a terminal using:
java -jar bayes.jar.
You are encouraged to try to model the earthquake example on page 512 in the course book as a warmup. It is strongly recommended that you have a look at the first and the third tutorials listed, since this will make the rest of the lab go much quicker. The topics in tutorials 4-6 are not covered in this lab, but read them if you are interested in the topic.
Note: The networks you save from and load into the program are in .xml format. If you have trouble saving an xml-file from the applet you can click on the "Edit/ViewEdit Text representation (.xml format)" in the program and copy-paste the contents to a new local file.
Part 1: Inference in an existing Bayesian network
In this part of the lab, you will be provided with an existing Bayesian Network. The purpose is to provide you with a chance to query the network and investigate probabilisitic inference on such networks. You will then use the network to answer a few questions, which will aid you in understanding the basics of probabilistic inference in Bayesian networks.
Scenario
The local nuclear power plant has been running for a long time and now the owner (mr M.B.) wants to know whether there has been any degradation in the safety of the plant. He hires a group of safety experts who will use Bayesian Networks as a modeling tool for prediction and explanation. After gathering empirical data the plant's consultants created the network in Figure 1. The underlying data is available in this file. 
Figure 1: The Bayesian Network for the nuclear plant.
- Save a copy of the file. Start the applet and choose "File/Load Problem" and select the file you saved.
- You should now see that a network has been created in the applet window.
- Important: Set the Network Options / Decimal Places for Monitoring to 5. This means that you will be able to accurately see changes in probabilities.
Exercises
Use the applet and the loaded Bayesian Network to complete the exercises below.- What is the risk of a meltdown in the power plant during a day if no observations have been made? What if the temperatue is cold?
-
The conditional probabilities for stochastic variables are often estimated by repeated experiments or observations and they are sometimes very difficult to get accurate statistics for. Think about the variables in the power plant example and how these could be measured. What conditional probabilities in the model do you think are difficult (or impossible) to estimate in real life?
Hint: Consider things that happen very rarely and situations where experiments are impossible or dangerous. - Assume that we want Temperature to be changed into a more accurate variable. How could we accomplish this in our model?
- What does a probability table in a Bayesian network represent?
- What is the probability of a meltdown if you know that there is both a water leak and a pump failure? Would knowing the state of any other variable matter? Explain your reasoning!
- Set the observations of Temperature to normal and PumpFailure to false. Now, suppose that the water leak warning sensor indicates a failure. What is the risk of a meltdown in that case? Compare this with the risk of a meltdown when there is an actual water leak. In your own words, what is the difference?
-
In the previous exercise you found the probabilities by querying the network. Now we want to calculate the conditional probabilities manually. Write down your calculations and include them in the answer.
All the values needed can be found in the probability tables of the nodes in the network. The figure below can be used as a guide (the procedure is described in the course book). The first line in the figure shows the formula for calculating the probability of a meltdown; however, in order to complete the calculation we first need to calculate all the individual terms.
Note: The Temperature should be set to normal and PumpFailure should be set to false, that is, our final answer should match the answer in the previous exercise.
L=WaterLeak, W=WaterLeakWarning, M=Meltdown
Good news everyone! New temperature statistics from SMHI are in and it turns out that the temperature is actually within normal range 90% of the time, while extreme temperatures (low and high) only make up 5% each. Update the network to reflect this new knowledge before moving on to exercise 8.
-
In your own words, explain what is meant by a joint probability distribution ("simultanfördelning"). Manually calculate the joint distribution of
P(Meltdown=F, PumpFailureWarning=F, PumpFailure=F, WaterLeakWaring=F, WaterLeak=F, Temperature=Normal)
Use the chain rule to rewrite the joint distribution as a product of P(child|parent) expressions.
Is this a common state for the nuclear plant to be in?
Part 2: Extending a network
Scenario
Mr. M.B. is quite selfish and wants to optimize profit of the plant at the expense of safety, yet he is very worried about his own survival. Instead of increasing the safety of the plant, which is costly, he decides to analyse his chances of escaping from the plant in case of a meltdown. Mr M.B. asks you to investigate the properties of his escape vehicle (his car). After significant research and a series of experiments you come up with the following conditional and prior probabilities:- P(battery | temperature=cold) = 0.80
- P(battery | temperature=normal) = 0.98
- P(radio | battery) = 0.95
- P(ignition | battery) = 0.81
- P(gas) = 0.69
- P(starts | gas ∧ ignition) = 0.91
- P(moves | starts) = 0.99
- P(survives | moves ∧ meltdown) = 0.86
- P(survives | moves ∧ ¬meltdown) = P(survives | ¬moves ∧ ¬meltdown) = 1.0
- P(survives | ¬moves ∧ meltdown) = 0.0
Exercises
- Model the car and integrate it with the model of the plant by looking at the probabilities above. Use the existing node Temperature as your starting point. Fill in any remaining probabilities by using common-sense reasoning about the domain (i.e. leaving them as the default 0.5 is not acceptable). Save the new network as lab5-part2-LiU-ID-1_LiU-ID-2.xml.
- The owner tries to show off for his employees by demonstrating the many features of his car radio, but the radio is not working. How did the owner's chances of survival change after this observation? Explain why.
- Give two examples of different patterns for conditional independence in your network. Also try to explain conditional dependence more generally using the literature.
Part 3: More extensions
Scenario
After your excellent analysis of the plant and of the owner's car, he realizes that his life is in grave danger if the plant has a meltdown. He realizes that he needs to hire someone to be in charge of the plant's safety. After several interviews he decides that a Mr H.S. is the most suitable person for the job (because he practically works for free). Mr M.B. again ask you to modify the model (i.e. extend from part 2) to include his new employee who has some less appealing properties:- He sleeps a lot during work, which means that he can not react that rapidly to warning signals and so on.
- He is very incompetent. Even if he is awake he doesn't always know what to do when an alarm goes off.
- He has a less than healthy appreciation for a beverage named "Duff", which lowers his competence even further and increases the risk of him falling asleep.
Exercises
-
Create a model of the properties of the new employee. The requirements of the model are the following:
- The extension should include at least four random discrete variables (i.e. nodes).
- All probabilities should be set and match the informal description of Mr H.S.'s properties.
- Think carefully about the direction of your causal relationships!
- The new network should be saved as a new file lab5-part3-LiU-ID-1_LiU-ID-2.xml. (Do not replace the old file!)
-
Assume that we have some additional money that can be invested in the system to improve the safety. What would be the impact of:
- Buying a new pump to reduce the risk of pump failure to 0.0001
- Improving the pipes to reduce the risk of water leak to 0.0001
- Make it impossible for Mr. H.S. to fall asleep at the control board.
-
Mr H.S. fell asleep on one of the plant's couches. When he wakes up, he hears someone scream: "There is one or more warning signals beeping in your control room!". Mr H.S. realizes that he doesn't have time to fix the error before it's too late.
What is the chance that the owner will survive in this new scenario? (notice that this ques-tion involves a disjunction which cannot be answered by querying the network as is). Add a node to your network to model the disjunction. Save the modified file as lab5-part3-vg-LiU-ID-1_LiU-ID-2.xml file with your new network. - What unrealistic assumptions do you make when creating a Bayesian Network model of a person? Try to motivate why such a model can still be useful.
Hand-in
- Save the modified networks and the document with exercises as PDF.
- Review before handing in:
- Show an assistant your calculations for exercises 7 and 8 in part 1.
- Briefly describe your extension of the network in part 3 and show that no fields in the probability tables have been left at their default values.
- (VG only) Describe the your solution for part 3.
- Upload your completed files (the networks and the exercises document) to Lisam.
Sidansvarig: Robin Keskisärkkä
