How to Build a (Limited Memory) Influence Diagram¶
This tutorial shows you how to implement a small influence diagram in the HUGIN Graphical User Interface. It requires that you have already constructed the Bayesian network from the How to Build a Bayesian Network Tutorial. The influence diagram you are about to implement is the one modeled in the Influence Diagrams Tutorial. It helps plantation owner Apple Jack to decide whether or not to give his apple tree, which is losing its leaves, some treatment. The qualitative representation of the influence diagram is shown in Figure 1.
Open the Network for Editing¶
First, you must open the network constructed in the How to Build BNs tutorial if it is not already open. Here is how to do it:
Select “Open” from the “File” menu.
Enter the name of the network file (“apple.net”). You can do this by selecting it from the list of network files (which have the “net” extension).
In Figure 2, the network has been opened and the HUGIN Graphical User Interface is currently working in Edit Mode. We need to be in Edit Mode to edit the network, so if your network window shows the network in Run Mode, press the Edit Mode tool button. If you opened it in Edit Mode, you do not need to do anything.
In the influence diagram in Figure 1, there are three nodes very similar to those that we already have. In this case, the HUGIN Graphical User Interface` allows you to copy a group of nodes and paste them in another area of the Network Pane. Here is how to do it:
Create a rectangle selection with the mouse cursor around all three nodes (drag a rectangle by holding down the left mouse button).
Select “Copy” from the “Edit” menu in the Main Window Menu Bar.
Select “Paste” from the “Edit” menu in the Main Window Menu Bar.
Move the new group of nodes to a spot where there is room for them.
The HUGIN Graphical User Interface generates new names and labels for the new nodes. You can keep the names and change the labels to Sick’, Dry’, and Loses’ (you cannot use “Sick’” as the name because it contains the prime character which is illegal in names):
Select the node with the mouse cursor.
Enter “Node Properties” by pressing the node properties tool (the 2nd left-most tool button in the tool bar of the network window).
Change the “Label” field.
Press the “OK” button.
Perform the steps above for all three new nodes. Your network should then look as the one in Figure 3.
The next step is to add causal links from Sick to Sick’ and from Dry to Dry’: * Press the Link Tool. * Drag a link from Sick to Sick’ with the left mouse button (while holding down the SHIFT key). * Repeat for Dry to Dry’.
Holding down the SHIFT key enables you to create more causal links sequentially without having to reactivate the Link Tool.
Adding a Utility Node¶
So far, the network we have constructed is still a Bayesian network. Now, we shall make the first change that makes it an influence diagram. This change is the addition of a utility node. The utility node we shall add is the Harv node (see Figure 1) representing the utility gained from the harvest. Here is how to add it:
Press the Utility Tool (to the right of the Link Tool).
Click somewhere in the Network Pane (a good place would be in the lower right corner besides the Loses’ node).
Change the name and label of the new utility node to “Harv”.
The harvest depends on the state of Sick’ and thus there is an link from Sick’ to Harv. Add this link:
Press the Link Tool.
Drag a link from Sick’ to Harv.
The utility of the harvest was specified to that found in Table 1.
You enter the values of Table 1 into the utility table of Harv as follows:
Select the Harv node by clicking it with the left mouse button.
Enter the values from Table 1 in the utility table in the Tables Pane.
A Desicion Node and One More Utility Node¶
Now, you are about to add the decision node Treat (see Figure 1). This is done similar to the way you add chance nodes and utility nodes:
Press the Decision Tool (to the right of the Utility Tool).
Click somewhere in the Network Pane (a good place would be to the right of the Dry node)
Change the name and label of the new decision node to “Treat”.
You add an action to a decision node in the same way as you add a state to a chance node:
Select the Treat node with the left mouse button.
Press the add state tool.
Change the action names to “treat” and “not”.
The Treat decision node has an impact on the Sick’ node so:
Add a link from Treat to Sick’.
The new decision node represents the decision to give the tree some treatment or not. If the plantation owner (Apple Jack) chooses to give treatment this will cost him something which shall be modeled by the Cost utility node. The Cost node has the utility table shown in Table 2.
Now, add the Cost utility node to the influence diagram:
Add a new utility node (a good place would be to the right of the Treat node).
Change the name and label of this node to “Cost”
Add a link from Treat to Cost.
Fill in Table 2 in the utility table of Cost.
Filling in CPTs¶
When we copied the nodes Sick’ and Dry’, they inherited the CPTs of Sick and Dry. However, as both these nodes have become children of other nodes, their CPTs are no longer correct. Their new CPTs were specified to those found in Table 3 and Table 4. * Fill in Table 3 as the CPT of Sick’. * Fill in Table 4 as the CPT of Dry’.
Now, your (limited memory) influence diagram (LIMID) is finished and it should look like the one in Figure 4. At this point it would be a good idea to save your LIMID.
Compiling the Limited Memory Influence Diagram¶
You can now try out the LIMID. First, compile the LIMID:
Press the compile tool (the right most tool button in the network window Tool Bar).
The compilation of an influence diagram may produce some of the same errors as described in the How to Build BNs tutorial. If the LIMID does not compile, you have probably made some minor error. Once the influence diagram has been compiled, probabilities and expected utilities are computed under the initial policy. To solve the influence diagram it is necessary to invoke Single Policy Updating.
What Should Apple Jack Do?¶
When the LIMID has been compiled, you should do a Single Policy Updating . Now, imagine that the only thing Jack knows about his tree is that it is losing leaves. Then, what will be the best thing for him to do? To find out this, follow these steps:
Expand the Loses chance node and the Treat decision node in the node list pane on the left (simply select them).
Enter the evidence that Loses is “yes” (by double clicking the “yes” state).
Propagate the influence diagram (press the Sum Propagation Tool, unless auto-propagate is set).
Read the expected utility of “treat” and “not” in the Treat decision node.
You should be reading something looking like that in Figure 5.
You read 11514 as the expected utility of doing nothing. This suggests that it will be best for Apple Jack not to treat the tree.
This finishes the tutorial. You should now be able use the HUGIN Graphical User Interface to construct your own (limited-memory) influence diagrams. However, if you want to create large and complex models, you should study the area more than just reading this tutorial.
Please read the document semantics of LIMID to learn more about LIMIDs.