Hot Links
Building a Bayesian NetworkThis tutorial shows you how to implement a small Bayesian network (BN) in the Hugin GUI. The BN you are about to implement is the one modeled in the apple tree example in the basic concepts section . In the next tutorial, you will extend this BN to an influence diagram. The qualitative representation of our BN is shown in figure 1.
Figure 1: BN representing the domain of the apple tree problem. If you want to understand the design of this BN, you should read about it in the basic concepts section. Constructing a New BNWhen you start up the Hugin GUI, the edit window opens. This window contains a menu bar, a tool bar, and a document pane. In the document pane, a new empty network called "unnamed1" is automatically opened in a network window (see figure 2). It starts up in "edit" mode which allows you to start constructing the BN immediately (the other main mode is "run" mode which allows you to use the BN).
Figure 2: The network window containing a tool bar, a node edit pane, and a network pane. Adding NodesThe first thing we will do is add the Sick node. This can be done as follows:
When you have clicked in the network pane, a node labeled "C1" appears. We want to change this label to "Sick":
The "Name" is the internal name of the node while "Label" is the label of the node. If no label is specified (as was the case before you changed the label) the label used is the internal name. The internal name can consist of only the letters 'a'-'z' and 'A'-'Z', the digits '0'-'9', and the underscore character '_' while the label can be almost anything.
Figure 3: From left: The discrete chance tool, the node properties tool, and the causal arrow tool. The Dry and Loses nodes are added the same way. You can add more nodes without having to press the discrete chance tool all the time by holding down the SHIFT key while clicking in the network pane. When you have chosen a node in the network pane, you can access the node properties tool by holding down the right mouse button.
Figure 4: The network pane contains the three nodes Sick, Dry, and Loses that have been added to the BN. The node edit pane contains the CPT of the currently active node. Adding Causal ArrowsNow, you should have a BN similar to the one shown in the network pane in figure 4. To add the causal arrows from Sick to Loses and from Dry to Loses, do as follows:
What you have by now should be the complete qualitative representation which is similar to the one in figure 1. The next step will be to specify the states and the conditional probability table (CPT) of each node. The StatesIn the introduction to BNs the states of the nodes were specified as follows: Sick has two states: "sick" and "not", Dry has two states: "dry" and "not", and Loses has two states "yes" and "no". First, we shall tell you how to specify the states of Sick:
Now, do the same with Dry.
Figure 5: The add/delete state tools. You can do exactly the same with Loses, but you might be a little surprised when selecting Loses as the active node because the CPT of Loses is a little bigger than those of Sick and Dry. This is just because Loses has parent nodes (which Sick and Dry have not).
Entering CPT ValuesThe next step is to enter the CPT values correctly (as default the Hugin GUI has given all nodes a uniform distribution). The values were specified in the introduction to BNs and they are shown in table 1, 2, and 3.
First, enter the values into the Sick node:
Enter the values of Dry and Loses the same way. When you enter the values into the CPT of the Loses node, be careful to get it done right. When you have entered all CPTs, the network window should look like figure 6.
Figure 6: The document window with Loses chosen as currently active node. The CPT of Loses is seen in the node edit pane. This finishes the construction of the BN. At this point it would be a good idea to save the BN. Here is how to do it:
Now we have finished constructing the Hugin knowledge base using Bayesian network technology. Now we want to compile and run the Hugin knowledge base and see if it is behaving correctly. |
|||||||||||||||||||||||||||||||||




