Hot Links
Building a Bayesian Network (Continued)Compiling the BNNow it is time to compile the network and see how it works:
Figure 7: The run mode tool button The compiler checks for the following errors:
If you have followed the guidance of this tutorial, there should not be any errors in the compilation process. The compilation should be finished very fast with a small BN like ours. After the compilation, the "run" mode is entered (you have so far only been working in "edit" mode). Running the BNRunning in "run" mode, the network window is split into two by a vertical separation (see figure 8). To the left is the node list pane and to the right is the network pane.
Figure 8: The network window in "run" mode. To the left is the node list pane (having Loses and Sick expanded) and to the right is the network pane. You can view the probabilities of a node being in a certain state by expanding the node in the node list pane. You expand a node by double clicking it in the node list pane (if you click on the small node icon in the node list pane, you only need to click it once). Now, expand Loses and Sick:
You can also expand all nodes at once by pressing the expand node list tool in the tool bar just to the right of the node properties tool. Is the tree sick?Now, imagine that you want to use your BN to find the probability of an apple tree being sick given the information that the tree is losing its leaves. This is done as follows:
Figure 9: The sum propagation tool This should give the output shown in figure 10.
Figure 10: Our BN after entrance of the evidence that the tree is losing its leaves and sum propagation The probability of the tree being sick is now 0.49. If you do not read the value specified above, you have probably mistyped something when filling in the CPTs. Then, check the CPTs of all the nodes. The Monitor WindowsIn the last section, you used the node list pane to enter evidence and retrieve beliefs. You can also do this by using the monitor windows. The monitor windows show the same information as the node list pane but you have the opportunity to place the monitor windows near the corresponding nodes of the BN in the network pane. You can open a monitor window for each node in the network pane, but the best way to use them is probably only to open a monitor window for the nodes in the BN which have special interest. Else, they might take up too much space. Now, we shall open monitor windows for Sick and Loses and repeat the calculations from before. First, initialize the BN:
Then, we are ready to open the monitor windows of Sick and Loses.
Figure 11: Monitor windows of Sick and loses are now shown in the network pane Now you know all you need to know to continue to the second tutorial showing you how to construct a Hugin knowledge base using influence diagrams. The rest of this first tutorial introduces some very useful aspects of the Hugin GUI but can be skipped. The most Likely CombinationFrom the propagation in the previous section we could see that the probability of the tree suffering from drought is 0.47. In both the case of Sick and Dry it is more likely that the state is "not". This could make one believe that the most likely combination of states is when both Sick and Dry are in state "not". However, this is a wrong conclusion. If you want to find the most likely combination of states in all nodes, you should use max propagation (in stead of sum propagation). The max propagation tool is found in the tool bar just to the right of the sum propagation tool. Now, try to press the max propagation tool. In each node, a state having the value 100.00 belongs to a most likely combination of states. In this case, this gives one unique combination being the most likely: Sick is "sick" and Dry is "not" We see that even if Sick="sick" is less likely than Sick="not", Sick="sick" is contained in the most likely combination of the states of the nodes while Sick="not" is not. This shows that you need to be careful about your conclusions from the result of a propagation. Now, one might want to know the probability of this most likely combination of states (or of any other combination of states) under the assumption that the entered evidence holds. Calculating the Probability of a Combination of StatesHere, we shall describe a technique to calculate the probability of the most likely combination of states given the evidence that the apple tree is losing its leaves. This probability is written: P(Sick="yes", Dry="not" | Loses="yes") Any time you perform sum propagation in your BN, the probability of the entered evidence is shown in the lower left corner of the HUGIN Runtime window (the P(All) value). If you have chosen the "yes" state of the Loses node and performed sum propagation, you can read the probability of Loses="yes" (written P(Loses="yes")). This value should be 0.1832. The technique uses the following rule from probability theory (known as the fundamental rule): P(A, B) = P(A | B) P(B) The only kind of probability we can get from HUGIN is the probability of a series of bits of evidence which can be written in the form: P(A1, A2,..., An) We use the fundamental rule to rewrite our requested probability to some expression composed by such components: P(Sick="yes", Dry="not" | Loses="yes") = P(Sick="sick", Dry="not", Loses="yes") / P(Loses="yes") In the fundamental rule, we have divided both sides with P(B). Then we have substituted A with Sick="yes", Dry="not" and B with Loses="yes". We already know P(Loses="yes") so we only need to calculate P(Sick="sick", Dry="not", Loses="yes"). This is done as follows:
This value should be 0.081. Now, we are ready to calculate the requested probability: P(Sick="yes", Dry="not" | Loses="yes") = 0.081 / 0.1832 = 0.442 So, the probability of the most likely combination of states of Sick and Dry, given that Loses="yes", is 0.442. This finishes the first tutorial. If you want to learn how to construct a small influence diagram, you should go through the second tutorial. |



