# All

## About

The About item of the Help menu gives you information about the current licence of HUGIN Runtime. This includes information about the HUGIN Sysem, the version and copyrights of this version, and who this licence belongs to.

## Add State

The add state function can be activated from the Add State item in the Edit menu or from the add state button in the edit mode tool bar (the button shown in figure 1).

The add state function is fast and easy to use when editing a node table manually. However, if you are using expressions, you will have to edit the states using the Node Properties dialog because states are not visible in the node edit pane.

Figure 1: The add state tool button from the edit mode tool bar.

The add state function adds a new state/decision to the node currently active in the node edit pane (only discrete chance nodes and decision nodes). If the currently active node is a discrete chance node, this state is named "State n" (where n is the total number of states of the node after the new state has been added). If the currently active node is a decision node, the decision/action is named "Action n"

## Align

The align function is activated by selecting the About item from the Options menu. The Align item has five sub items which are seen in figure 2.

Figure 2: The sub items of Align in the Options menu.

The four "Align" sub items are used for aligning a series of nodes to the same horizontal or vertical line. The line is specified by "Left", "Right", "Top", or "Bottom". The "Align" sub items can only be activated if two or more nodes are currently selected. When an "Align" sub item is activated, all the currently selected nodes are placed on the specified line. If for example the "Align Right" sub item is activated, the specified line is the vertical line though the right most node in the series of selected nodes ("Align Left" specifies a vertical line through the left most selected node, while "Align Top" and "Align Bottom" specifies horizontal lines through the top most and bottom most selected nodes respectively).

If the specified line is a vertical line the selected nodes keep their horizontal coordinate and if it is a horizontal line they keep their vertical coordinate.

The "Snap to Grid" sub item of the "Align" item moves all nodes to the nearest point in the specified grid.

## Approximate

If you need to (want to) make your Hugin network even faster than what you can achieve by ordinary compression, you can use the approximation option.

Approximation is activated in the Compilation tab of the Network Properties dialog box. This functions works by eliminating the smallest table values of the internal network representation (making them zero), so that the compression function will be more efficient (compression can save space when there are a lot of zero probabilities).

To specify which table values to eliminate, you must set an epsilon value which specifies how much probability mass to eliminate. Then, small table values are set to zero - from the smallest end, until you have removed an amount of epsilon probability mass.

You should be careful when using approximation. It can cause conflicts when rare cases occur, since small (though existing) probability mass has been eliminated.

## Arrange Icons

The arrange icons functions can be activated from the Arrange Icons item in the Window menu or from the arrange icons button in the main window tool bar (the button shown in figure 3).

Figure 3: The arrange icons tool button from the main window tool bar.

The arrange icons function places all iconized network windows in a row in the bottom of the main window.

## Auto Propagation

Auto propagation can be enabled or disabled in the Auto Propagate tab of the Network Properties dialog box (see figure 4).

Auto propagation makes hugin propagate automatically with a specific propagation method every time you enter new evidence.

Figure 4: The Network Properties dialog box showing the Auto Propagate tab.

In the Auto Propagate tab you can select one of two radio buttons to specify if you want to use auto propagation or not. If you choose auto propagation, you can also specify which propagation method you want to use. In most cases you would want to stick with Sum Normal.

## Auto Update Graphs

Hugin can be specified to auto update graphs for continuous chance nodes. This is done in the Auto Propagate tab of the Network Properties dialog box (see figure 5). Simply check the check box in the Monitor Updating group box.

Figure 5: The Network Properties dialog box showing the Auto Propagate tab.

If auto update graph is enabled, the graphs in the monitor windows of continuous chance nodes will automatically be updated when new evidence is entered. This can be very helpful on small networks but should not be used on larger networks because it can be very time consuming.

## Bar Lenght

The maximal bar length is displayed in the top of the node list pane of the run mode network window.

You can resize this bar length by moving the mouse cursor over the right end of this bar length indicator and dragging it horizontally. You can also resize it by activating Size Bar Length from the View menu.

## Bayesian Belief Network (Bbn)

A Bayesian belief network (Bbn) is a set of nodes representing random variables and a set of arrows connecting these nodes in an acyclic manner. Each node has assigned a function which describes how the state of the node depends on the parents of the node.

In Hugin Bbns, you can represent two kinds of random variables: discrete chance nodes having a discrete finite state space and continuous chance nodes having a continuous infinite state space.

For the discrete chance nodes, the function describing how the node depends on its parents is a conditional probability table. For continuous chance nodes it is a pdf (in Hugin it must be a Gaussian normal distribution function).

In Hugin, you can also compose influence diagrams which are Bbns extended with decisions and a utility function.

A Bayesian belief network (Bbn) is really just a smart representation of a domain of dependent random variables.

Many real life situations can be modelled as a domain of random variables (you could model a group of related deceases: risk factors, deceases, and symptoms). A domain of random variables could form the basis of a decision support system to help actors decide what would be most beneficial in a given situation.

If you wanted to represent a domain of random variables (all having a discrete and finite state space), you could always do this by the joint probability table of the entire domain. That is, a table with an entry for each configuration of the nodes of the domain. However, the number of configurations of a domain grows exponentially in the number of random variables so this would only work for very small domains.

What you use to keep the representation size to a minimum in Bbns is the conditional independencies in the domain: Very often the knowledge about a random variable being in a specific state will make other variables independent and thus it would be overkill to have an entry for all combinations of these independent variables (they would all contain the same value).

This is not the right place to describe the theory behind Bbns in detail. You should be able to find some useful literature about the subject elsewhere. Here is a place to start: Finn V. Jensen: "An Introduction to Bayesian Networks" - May 1996.

## Belief Precision

The belief precision function is activated by selecting Belief Precision from the View menu. The Belief Precision item has a series of sub items which are shown in figure 6.

Figure 6: The sub items of Belief Precision in the View menu.

The first sub item is Max Precision which when selected displays all beliefs as numbers between 0 and 1 with up to six significant digits (single precision values). In influence diagrams, expected utilities are displayed also with up to six significant digits.

The five "Percent" sub items enables display of beliefs as numbers between 0 and 100 (percent). Each of these sub items specifies a specific number of digits following the decimal point. Currently HUGIN Runtime does not allow these display modes for influence diagrams and when continuous nodes appear in the network.

The last sub item is "No Belief Values". This disables the display of belief values. In stead, only the graphical display of beliefs is used. Currently HUGIN Runtime does not allow you to disable display of beliefs and expected utilities for influence diagrams and when continuous nodes appear in the network.

## Cascade Windows

The cascade windows function can be activated from the Cascade item in the Window menu or from the cascade windows button in the main window tool bar (the button shown in figure 7).

Figure 7: The cascade windows tool button from the main window tool bar.

The cascade windows function arranges the network windows in the main window in a cascade (window upon window upon window...).

## Case Generator

Based on the current conditional probability distribution Hugin Runtime can generate cases and save these into a file.

Cases can be generated in two different ways: MCAR (Missing Completely at Random) or MAR (Missing at Random).

MCAR sets some values to N/A by removing values of some nodes in the generated case set randomly (i.e. MCAR considers all the values in the generated cases and not one case at a time).

MAR randomly sets some values in a case to N/A based on auto-generated templates. These templates specify that if some nodes have a specific value then randomly set the values of a subset of the nodes in this case to N/A. Note that the specification of the templates is generated randomly.

In both cases the conditional probability distribution is considered as a factor to the number of cases generated with a specific set of observations. Also in both MCAR and MAR it is possible to indicate the percentage of missing values.

## Causal Arrow

A causal arrow is a link from a chance node (discrete or continuous) or a decision node to a chance node.

It defines a causal dependency from the parent node to the child node. That is, the state of the parent has impact on the state of the child.

It can sometimes be difficult to determine what is a causal dependency and what is not. Eg. imagine you have two nodes: One for "Red Spots" and one for "Measles". Some might say that when you observe red spots on a child it is very likely that the child has measles so you should add a link from "Red Spots" to "Measles". This, however, is terribly WRONG! The relation between red spots and measles is that measles causes red spots. The link should go from "Measles" to "Red Spots" (because it is a causal arrow).

Always make sure that the causal arrows you add are causal.

## Close

The close function is activated by selecting the Close item in the File menu.

The close function closes the currently active network window. If there has been changes to the network of this network window, the user is asked if he/she wants to save these changes before the network window is closed.

## Close All

The close all function is activated by selecting the Close All item in the Window menu.

The close all function closes all network windows currently open in the main window. If there has been changes to the network of a network window, the user is asked if he/she wants to save these changes before this network window is closed.

## Collapse Node List

The collapse node list function can be activated from the Collapse Node List item in the View menu or from the collapse node list button in the run mode tool bar (the button shown in figure 8).

Figure 8: The collapse node list tool button from the run mode tool bar.

The collapse node list function disables the display of states/decisions and their belief/expected utility in the node list pane.

You can collapse a single node in the node list by clicking it with the mouse.

This function has an inverse in the expand node list function.

## Compile

The compile function is activated from edit mode either by pressing the compile tool button (see figure 9) or by selecting the Run Mode item of the Network menu.

Figure 9: The compile tool button from the network window tool bar.

You can also activate the compile function from run mode. Here, the Run Mode item of the Network menu is replaced with the Recompile item.

When activating the compile function from edit mode, the current network is compiled and run mode is entered.

When activating the compile function from run mode, the current network is recompiled (this can sometimes be useful).

The compilation of a HUGIN network is basicly a transformation from the Bayesian belief network form to the junction tree form in which the propagations can take place. The theory behind the transformation to a junction tree is not covered in this manual.

You can specify certain properties on the compilation in Hugin from the Network Properties item of the Network menu. Figure 10 shows the Compilation tab of the Network Properties dialog box.

Figure 10: The Network Properties dialog box showing the Compilation tab.

Generally, it is NP hard (mathematical way to say that it is impossible within reasonable time) to find the best internal representation of a Hugin network (the junction tree representation). This is basically because it is NP hard to triangulate a graph optimally. The triangulation methods listed in the Compilation tab are different heuristic methods to perform the triangulation step of the compilation process. In some cases one method will be the best - in other cases another one will. If you have a Hugin network which is rather complex and seems to have poor performance, you might try another triangulation method.

You can sometimes save some space by using the optimization facilities. These are activated in the bottom half of the Compilation tab. You can choose between ordinary compression and compression involving approximation. The latter will cause less precision while the first will not.

If you select Approximate, you must also specify an epsilon value stating how much loss of precision you will allow. The larger epsilon value you specify, the less precision (read more about this in the Approximate section).

## Compress

To optimize a Hugin network you can also use the compression facility activated by the Compress check box found in the Compilation tab of the Network Properties dialog box.

Compression will optimize the way the tables of the internal representations are stored. Basically, you can save space any time a table entry has a zero value (probability). This means that the more zero-probabilities you find in the tables of your Hugin network, the more effect will you get from using the compression option.

You can compress even more using approximation (if you are willing to work with less precision).

## Conditional Probability Table (cpt)

Each discrete chance node in a Bayesian belief network or a influence diagram is assigned a conditional probability table (abbreviated cpt). The node name and node label displayed in the node edit pane when working in edit mode specifies a currently selected node. If this node is a discrete chance node, the table shown in the node edit pane is a cpt.

Only if you have chosen to specify the table manually (alternative to using expressions), you can see the entire cpt. Otherwise, you see the table of expressions specifying the table.

The table shown in the node edit pane is different depending on the type of the currently selected node:

- If the currently selected node is a discrete chance node, the table is a true cpt.
- If the currently selected node is a utility node, the table is a utility table rather than a cpt.
- If the currently selected node is a decision node, the table is not actually a cpt. In stead it contains only one column of the decisions of the decision node.
- If the currently selected node is a continuous chance node, the table specifies a Gaussian normal distribution function rather than a cpt.

Figure 11 shows a cpt for a discrete chance node with one parent (Color).

Figure 11: The cpt of a node with one parent (Color).

The states of the currently selected node are those found in the left most column below the parent labels. You can change these state names by selecting them with the mouse cursor and typing in a new name from the keyboard.

Each numeric value in the cpt is the probability of the currently selected node being in the state found in the left most column in the actual row - when the parents (if any) are in the states found in the top of the actual column.

You can change a specific numeric value by selecting it with the mouse cursor and typing in a new value from the keyboard.

## Continuous Gaussian (CG) Node

See continuous chance node.

## Continuous Chance Node

A continuous chance node (or CG node = continuous Gaussian node) represents a random variable with a Gaussian (normal) conditional distribution function. A continuous chance node can be added to the current network by activating the continuous chance tool and clicking somewhere in the network pane.

Currently, there are some restrictions to the use of continuous chance nodes, partly because the underlying theory is still being developed. The restrictions are listed below:

- The only continuous chance nodes currently supported represent variables with Gaussian (normal) distribution functions.
- A continuous chance node cannot be parent of a discrete chance node.
- Continuous nodes cannot be used in influence diagrams. That is, continuous nodes cannot exist in a network also containing utility nodes or decision nodes

## Continuous Chance Tool

The continuous chance tool can be activated either from the Continuous Chance Tool item of the Edit menu or from the continuous chance tool button in the edit mode tool bar (the button shown in figure 12).

Figure 12: The continuous chance tool button from the edit mode tool bar.

When the continuous chance tool is activated (when the continuous chance tool button is pressed) you can place a continuous chance node in the network pane: Simply click the mouse somewhere within the network pane. When you have placed the continuous chance node the select tool is normally activated again. If you want to keep the continuous chance tool activated (to create a series of nodes) hold down the SHIFT key while placing a node.

## Copy

The copy function is activated either from the Copy (or Copy DDE Link) item of the Edit menu or from pressing the copy button which is found in both the edit mode tool bar and the run mode tool bar (see figure 13).

Figure 13: The copy tool button from the main window tool bar.

The copy function has two meanings:

1. If you are in run mode and you select a node or a state of a node in the node list pane, then if you activate the copy function, it copies a DDE link. See the Copy DDE link section for more information about this case.
2. If you are in edit mode or if you are in run mode and you select one or more nodes in the network pane, then if you activate the copy function, it copies the node (a node is seen as both a graphical object and an object in a Bayesian belief network or influence diagram). The rest of this section describes this meaning of the copy function.

When you have activated the copy function, you have the selected sub network copied onto the clipboard of the Windows system. Then you can use the paste function in HUGIN Runtime to make a copy of it in the same or another network pane (which must be in edit mode).

When you cut a selected sub network, all internal links in the sub network are copied to the clipboard. Also links from external nodes to nodes within the selection are copied and can be restored when pasting. Links from nodes within the selection to external nodes, however, are not copied.

When pasting a sub network from the clipboard, a link from an external node to a node within the sub network is restored if the external node "exists" in the new network. Here, we say that a node "exists" if a node appears with the same node name as the external node in the original HUGIN network. The external node in the new network needs not have the same node label as the external node in the original network. If the external node does not "exist" in the new network, the link is not restored. This has impact on the conditional probability table of the node which the link pointed to and one should reconstruct it.

You can also use paste functions in other applications with the HUGIN network currently on the clipboard. This makes it easy to create figures for documentation reports.

## Copy DDE Link

The copy DDE link function is activated when you are in run mode and select a node or a state of a node and then either press the copy tool button (see figure 14) or select the Copy DDE Link item from the Edit menu.

Figure 14: The copy tool button from the main window tool bar.

When you have copied a node or state of a node as a DDE link, you can paste it in another program using "Paste special" (Excel) or equivalent. This creates a DDE connection from the probabilities calculated in HUGIN Runtime to the other program.

## Cut

The cut function is activated either by selecting the Cut item of the Edit menu or by pressing the cut tool button (see figure 15) of the main window tool bar.

Figure 15: The cut tool button from the main window tool bar.

The cut function can only be activated in edit mode and when one or more nodes or causal arrows are selected in the network pane.

The selected sub network will be deleted from the network pane and copied to the clipboard when the cut function is activated. Then you can paste this sub network to other open HUGIN networks or you can paste it in other applications having access to the clipboard.

When you cut a selected sub network, all internal links in the sub network are copied to the clipboard. Also links from external nodes to nodes within the selection are copied and can be restored when pasting. Links from nodes within the selection to external nodes, however, are not copied.

When pasting a sub network from the clipboard, a link from an external node to a node within the sub network is restored if the external node "exists" in the new network. Here, we say that a node "exists" if a node appears with the same node name as the external node in the original HUGIN network. The external node in the new network needs not have the same node label as the external node in the original network. If the external node does not "exist" in the new network, the link is not restored. This has impact on the conditional probability table of the node which the link pointed to and one should reconstruct it.

## DDE Connections

Hugin provides DDE (Dynamic Data Exchange). With DDE other programs (like Excel) are able to use the probabilities calculated in Hugin.

You establish a DDE connection with the following application, topic, and item:

- Application: This is the name of the service and will always, when communicating with Hugin, be the string "Hugin".
- Topic: The topic under DDE connections with hugin is the filename of the network, ex. "c:\mynets\net1.hkb".
- Item: This is the interesting part. Here we specify which data we would like to receive from the network. This can be in 1 of 4 forms:
  1. "?" - Request the names of all the nodes in the network
  2. "node-name:?" - Request the state labels for a node (Note the colon).
  3. "node-name:*" - Request values for all states of the node (Note the colon).
  4. "node-name:state-num" - Request the value for node node-name at state state-num (Again, note the colon).

1 and 2 are only supported as cold links, while 3 and 4 are supported as warm links (links that automatically get updated when values change).

You can easily copy a DDE link to the clipboard using the copy function. See the Copy DDE Link section to read more about this.

## DDE Indicator

The DDE indicator is found in the status bar of the main window. It indicates if the currently active network window has any DDE connections to other running applications. If there are DDE connections, the indicator is on. Otherwise, the indicator is greyed. In figure 16 the DDE indicator is on and thus it indicates a DDE connection.

Figure 16: The red circle shows the DDE indicator in the status bar of the main window. Here, it indicates that there is at least one DDE connection to another application.

## Decision Node

A decision node represents a decision to be made by the user. A decision node can be added to the current network by activating the decision tool and clicking somewhere in the network pane.

A Bbn extended with decision nodes and utility nodes are called href="#influence_diagram">influence diagrams. The decision nodes represent decisions controlled by an external user. This means that compared to discrete chance nodes decision nodes has no conditional probability table. In the influence diagram monitor windows for decision nodes and node list pane show the expected utility of choosing each decision (in stead of probabilities as in discrete chance nodes).

Decision nodes cannot appear in a network together with continuous chance nodes.

Decision nodes are assigned a type.

## Decision Tool

The decision tool can be activated either from the Decision Tool item of the Edit menu or from the decision tool button in the edit mode tool bar (the button shown in figure 17).

Figure 17: The decision tool button from the edit mode tool bar.

When the decision tool is activated (when the decision tool button is pressed) you can place a decision node in the network pane: Simply click the mouse somewhere within the network pane. When you have placed the decision node, the select tool is normally activated again. If you want keep the decision tool activated (to create a series of nodes) hold down the SHIFT key while placing a node.

## Delete

The delete function is activated either by selecting the Delete item of the Edit menu or by pressing the delete tool button (see figure 18) of the main window tool bar.

Figure 18: The delete tool button from the main window tool bar.

The delete function can only be activated in edit mode and when one or more nodes or causal arrows are selected in the network pane.

The selected sub network will be deleted from the network pane. It will not be copied to the clipboard. The cut function is very similar to delete but cut copies the deleted sub network to the clipboard.

## Delete State

The delete state function can be activated from the Delete State item in the Edit menu or from the delete state button in the edit mode tool bar (the button shown in figure 19).

The delete state function is fast and easy to use when editing a node table manually. However, if you are using expressions, you will have to edit the states using the Node Properties dialog because states are not visible in the node edit pane.

Figure 19: The delete state tool button from the edit mode tool bar.

The delete state function deletes a state/decision of the node currently active in the node edit pane. The delete state function only works for discrete chance nodes and decision nodes (in decision nodes it deletes a decision/action).

The delete state function can only be activated when the currently selected node has two or more states.

## Discrete Chance Node

A discrete chance node represents a discrete random variable with a finite number of states. A discrete chance node can be added to the current network by activating the discrete chance tool and clicking somewhere in the network pane.

When propagating, you can see the probabilities of each state in a discrete chance node either in the node list pane or by opening a monitor window for the node.

In an influence diagram, discrete chance nodes depending on a decision node cannot be properly calculated before the decision has been made. This means that one should never use the probabilities displayed for such nodes.

Discrete chance nodes are assigned a type.

## Discrete Chance Tool

The discrete chance tool can be activated either from the Discrete Chance Tool item of the Edit menu or from the discrete chance tool button in the edit mode tool bar (the button shown in figure 20).

Figure 20: The discrete chance tool button from the edit mode tool bar.

When the discrete chance tool is activated (when the discrete chance tool button is pressed) you can place a discrete chance node in the network pane: Simply click the mouse somewhere within the network pane. When you have placed the discrete chance node the select tool is normally activated again. If you want keep the discrete chance tool activated (to create a series of nodes) hold down the SHIFT key while placing a node.

## Display

In the Network Properties dialog box you find the Display tab which allows you to change diffent parameters in the display of the network. Figure 21 shows the Display tab.

Figure 21: The Network Properties dialog box showing the Display tab.

At the top of the Display tab you can specify the width and height of the nodes in the network pane. You can also specify a different font of the node labels. In the bottom you can set up a grid used in the network pane to help arranging the nodes.

## Edit Menu

The Edit menu (shown in figure 22) is found in the menu bar of the main window.

The Edit menu contains items covering functions mainly for constructing a HUGIN network. This means that most of them are only active in edit mode. Some of them, however, can also be used in run mode. In run mode, the Copy item can take another meaning when a node or a state of a node is selected in the node list pane: It changes its label to Copy DDE Link and it is now used for establishing DDE connections with other applications.

Figure 22: The contents of the Edit menu

## Edit Mode

When you are constructing your HUGIN network, you are running in edit mode. In figure 23 you can see a network window of a HUGIN network running in edit mode. In edit mode, the network window is split up in a node edit pane containing the table of the currently active node. Below the node edit pane is the network pane where the graph describing the network is found.

Figure 23: The network window of a HUGIN network running in edit mode.

You go from run mode to edit mode by pressing the edit mode tool button (see figure 24).

Figure 24: The edit mode tool button from the run mode tool bar.

## Enter Likelihood

The enter likelihood function is available in run mode. You can activate the enter likelihood function either by selecting the Enter Likelihood item of the Network menu or by pressing the enter likelihood tool button (see figure 25).

Figure 25: The enter likelihood tool button from the run mode tool bar.

Entrance of likelihood can only be used on discrete chance nodes.

Entrance of likelihood is what you do when you learn something about the state of the world which can be entered into a variable of your network. The simplest form is for example when you have a variable "Ball Color" stating the color of a ball drawn from a basket of red and blue balls. This variable has states "red" and "blue". Then, when you see the color of the ball is actually blue, you can enter this fact by saying that "Ball Color" takes state "blue". The easiest way to enter this is by using the select state function. However, you can also do it by entering likelihood. That is, you want to enter the fact that the probability of "Ball Color" being in state "blue" is 1 while the probability of "Ball Color" being in state "red" is 0.

When you have activated the enter likelihood function, the dialog window shown in figure 26 apears. Here, you can enter additional information that you might have come over.

Figure 26: The likelihood dialog window.

In the case of figure 26, we have a variable called "# Red Balls" counting the number of red balls in a basket containing 3 balls of which some are blue and some are red. If you have taken two balls up from the basket and both of these were blue, you know that at most 1 ball in the basket is red. This information can be given to the network by entering likelihood into the "# Red Balls" variable as we have done in figure 26. We give "0 balls" and "1 ball" equal positive probability while "2 balls" and "3 balls" get probability 0.

In the likelihood dialog window, you have a Node area and a Likelihood area. In the Node area, the label of the node is found. In the Likelihood area, there is a display showing what you have entered so far. Here, you can drag the bars representing a probability back and forward with the mouse. Below this display is a select field where you can choose between different standard probability values (0, 0.1, 0.33333, 0.5, etc.). Choosing one of these values will make the currently selected state in the display take this value as probability.

Below the display in the Likelihood area are also two buttons labelled "All 1" and "All 0". Pressing one of these makes all states in the display take values 1 or 0 respectively.

You should not be concerned with the fact that the sum of all probabilities are not necessaryly 1. HUGIN will normalize the values so that for example in the case shown in figure 26, "0 Balls" and "1 Ball" each get probability 0.5.

## Exit

Exit is activated by selecting the Exit item of the File menu. You can also activate exit by simply closing the main window.

The exit function closes all network windows and exits from HUGIN Runtime. Each time a network window is closed, HUGIN Runtime asks you to save the network of this window.

## Expand Node List

The expand node list function can be activated from the Expand Node List item in the View menu or from the expand node list button in the run mode tool bar (the button shown in figure 27).

Figure 27: The expand node list tool button from the run mode tool bar.

The expand node list function enables the display of states/decisions and their belief/expected utility of all nodes in the node list pane.

You can expand a single node in the node list by clicking it with the mouse.

This function has an inverse in the collapse node list function.

## Expression Builder

The Expression Builder is activated from the Build Expression item of the Table menu.

The Expression Builder assists the user in building expressions by providing a simple user interface for selecting a function and specifying arguments. When the user selects Build Expression, a dialog window appears showing all functions available for the currently edited expression (depending on the type of the currently selected node). This dialog is shown in figure 201. The functions are organized in a number of categories to make it faster to find a particular function.

Figure 201: The Select Function dialog of the Expression Builder.

After the user has selected a function the Specify Arguments dialog of the Expression Builder appears. This dialog prompts the user for arguments to the selected function. Figure 202 shows the Specify Arguments dialog.

Each argument must itself be an expression and can therefore be built using the Expression Builder. Pressing the Build button next to the argument edit box will start the Expression Builder for that argument.

If you want to use a parent in an expression, you must use its unique name. You can select a parent in the Parents list and then press the Insert button to insert it into the argument you are currently editing. Only discrete chance nodes and decision nodes can appear in expressions.

Figure 202: The Specify Arguments dialog of the Expression Builder.

## Expressions

It is possible to specify expressions as a more compact representation of the tables of discrete chance nodes and utility nodes.

From manual table editing mode you can switch to expression editing mode by selecting the Expressions item of the Table menu. You can also select the Specify Expressions button in the Table tab of the Node Properties dialog.

If you have chosen to edit the table of a discrete chance node or utility node in expression mode, you will see the label "Expression" in the left most column, below the parent labels (if any). Figure 210 shows the expression table of a discrete chance node in the node edit pane.

Figure 210: The node edit pane showing the expression table of a discrete chance node.

In expression mode, you can type in expressions in the table fields. If you are not that familiar with the expression language, you can use the node types are introduced.

The functions specified by expressions also differ in that some are deterministic functions specifying the exact state of a node, eg: nPeople = "nMen + nWomen" whereas others are distribution functions specifying the probability distribution of the states, eg: P(nSix) = "Binomial(nDice, 1/6)". There are a limited number of distribution functions available so Hugin will know how to interpret the expression you write.

The building blocks available for expressions are listed below.

### Constant Values

The following kinds of constants can be used in expressions: state labels, numeric values, and Boolean values.

State labels must be encapsulated in quotation characters (").

Numeric values are typed in as you would probably expect to do - without any encapsulating characters or other formatting stuff: Eg. "X + 3.4" (here, the quotation characters are used only to separate the expression from the rest of the text - it has nothing to do with state labels as discussed above).

There are two Boolean constant values: "false" and "true". Notice that the Boolean constants must be lower case.

### Discrete Distribution Functions

These distribution functions are available for numbered nodes only. You type a distribution function as the function name followed by a comma separated list of arguments in brackets. Eg. "Binomial(4, 0.2)".

Function | Node requirements | Comments | Arguments | Arg. range
Binomial | Numbered: 0, 1, 2, ... , n |  | n | 0, 1, 2, ...
p | [0,1]
Poisson | Numbered: 0, 1, 2, ... , n | n will get prob. mass of n, n+1, ... | Mean | ]0, inf[
Geometric | Numbered: 0, 1, 2, ... , n | n will get prob. mass of n, n+1, ... | p | [0, 1]

### Continuous Distribution Functions

These distribution functions are available for interval nodes.

Function | Node requirements | Comments | Arguments | Arg. range
Normal | Interval. First state must start in -inf. Last interval must end in inf. |  | Mean | ]-inf, inf[
Variance | ]0, inf[
Beta | Interval. First state must start below Lower. Last interval must end after Upper (see arguments). | If not specified, arguments Lower and Upper will be 0 and 1, respectively | Alpha | ]0, inf[
Beta | ]0, inf[
Lower (optional) | ]-inf, Upper[
Upper (optional) | ]Lower, inf[
Gamma | Interval: First state must start below 0. Last interval must end in inf. |  | Shape | ]0, inf[
Scale | ]0, inf[
Exponential | Interval: First state must start below 0. Last interval must end in inf. |  | Lambda | ]0, inf[
Weibull | Interval: First state must start below 0. Last interval must end in inf. |  | Shape | ]0, inf[
Scale | ]0, inf[
Uniform | Interval: The state intervals must cover Lower and Upper - at least in end points (see arguments). |  | Lower | ]-inf, Upper[
Upper | ]Lower, inf[

### Arithmetic Functions

The arithmetic functions can be used in deterministic expressions for numbered nodes, interval nodes, and utility nodes. They can also be used in all kinds of functions taking numeric arguments. Below are listed the arithmetic functions:

+ (sum)
- (subtract)
* (multiply)
/ (divide)
power
min
max
log
negate
log
exp
sqrt

The first four arithmetic functions (operators) use infix notation: "A + B". The rest have prefix notation: "max(A, B, 0.7)".

### Boolean Functions

The Boolean functions can be used in deterministic expressions for Boolean nodes. They can also be used in all kinds of functions taking Boolean arguments. The Boolean functions are:

and
or
not

Boolean functions have infix notation: "and(or(X, Y), A, B)".

### Comparison Operators

The comparison operators can be used in deterministic expressions for Boolean nodes. They can also be used in all kinds of functions taking Boolean arguments. Below are listed the comparison operators:

= (equals)
!= (equals not)
< (less than)
> (greater than)
<= (less than or equals)
>= (greater than or equals)

All comparison operators can be used to compare numeric values. The equality comparison operators (= and !=) can also be used to compare Boolean values and labels. All comparison operators use infix notation: "A = 14".

### The if-then-else Function

The if-then-else function takes three arguments: The first argument is the Boolean condition determining if the function should return the second or third argument as the result. Eg. "if(false, "yes", "no")" would return "no".

The if-then-else function can be used to combine both deterministic functions and distribution functions. Eg. if you are building a system for predicting how many times you will roll six with a number of dice, you could be in a situation where you were uncertain about whether the dice were fair or not, having probability 1/6 and 1/2 for rolling six respectively. If you have a Boolean node "DiceFake" representing this uncertainty, you could specify one of these two expressions:

"Binomial(nDice, if(DiceFake, 1/2, 1/6))"

or

"if(DiceFake, Binomial(nDice, 1/2), Binomial(nDice, 1/6)"

## File Menu

The File menu (shown in figure 28) is found in the menu bar of the main window.

The File menu contains items covering functions for manipulating network files (open, close, save, etc.).

Figure 28: The File menu.

## Gaussian Normal Distribution Function

Continuous chance nodes in a HUGIN network can be specified to have a Gaussian normal distribution function. This text does not cover a mathematically description of the Gaussian normal distribution function but rather a description of how it can be used in HUGIN network nodes.

The Gaussian normal distribution function is defined on the complete real axis. Any Gaussian normal distribution function can be specified by its mean and variance parameter. In HUGIN, a continuous chance node can have a single Gaussian normal distribution function for each configuration of its discrete parents states (both discrete chance nodes and decision nodes). If a continuous chance node has one or more continuous chance node as parent, the mean can be linearly dependent of the state of the continuous chance node parents.

In figure 30 is shown an example of the specification of a Gaussian normal distribution function of a continuous chance node (C3) having one discrete chance node (C1) and one continuous chance node (C2) as parents (see figure 29).

Figure 29: An example of a Bbn where the continuous chance node C3 has one discrete chance node (C1) and one continuous chance node (C2) as parents.

Figure 30: The specification of a Gaussian normal distribution function for C3 having one discrete chance node (C1) and one continuous chance node (C2) as parents.

This specification gives a Gaussian normal distribution function for each of the states of C1 (where N(m,v) is the Gaussian normal distribution function with mean m and variance v):

- C1="State 0": N(1 + (-2.1 * C2), 3).
- C1="State 1": N(2 + (-2.2 * C2), 3.5).

The numeric values in the C2 row of the table in figure 30 are multiplied with C2 in to form C2's contribution to the mean of C3.

Only the mean depends linearly on a continuous parent node. The variance is constant for each configuration of the states of the discrete parents.

## General Help

What you are currently looking at are the Hugin general help pages. From the Hugin Runtime user interface you can view these help pages by selecting the Help item of the Help menu or by pressing the Help button in the main window tool bar (the Help button is shown in figure 31).

Figure 31: The Help button of the main window tool bar.

## Graphical Display

In edit mode you can choose to see the cpt of a node graphically (in the node edit pane) by pressing the graphical display button in the tool bar of the edit mode network window. Figure 32 shows the graphical display button.

Figure 32: The graphical display button from the edit mode tool bar.

## Groups (and Colors)

You can specify different node groups in Hugin which can be used to group the nodes during composition of a network. The different groups each has assigned a color so that in the display of the network it is easy to distinguish nodes of different groups.

You can specify/edit the groups of your network in the Groups and Colors tab of the Network Properties dialog box. This tab is shown in figure 33.

Figure 33: The Network Properties dialog box showing the Groups and Colors tab.

When you use Hugin, you always use four default groups (maybe without recognizing them as groups). Each of the different types of nodes have their own default group: discrete chance nodes, continuous chance nodes, utility nodes, and decision nodes.

You add a new (user defined) group by typing the new group name in the small edit box below the list of groups and clicking the Add button to the right of the edit box. You can also rename a group, delete it, or move it up and down in the node groups list.

At the bottom of the Groups and Colors tab, you can change the color of the currently selected group in the groups list: Simply click the new color in the color palette.

You can assign one or more nodes in the network pane to a group by selecting them and clicking the right mouse button which opens a menu. From this menu, use the Assign to Group item to select a group. This way you can also remove a node from a specific group by selecting the No Group sub item of the Assign to Group item. You can assign nodes to groups in both edit mode and run mode since this has no real influence on the network structure.

## Group Indicator

The group indicator is found in the status bar of the main window. It indicates if the currently active network window has any user defined groups. If there are any user defined groups, the indicator is on. Otherwise, the indicator is greyed. In figure 34 the group indicator is on and thus it indicates that there are groups.

Figure 34: The red circle shows the group indicator in the status bar of the main window. Here, it indicates that there is at least one user defined group.

## Help

See General Help.

## Help Menu

The Help menu is found in the menu bar of the main window.

The Help menu contains items for different kinds information about Hugin Runtime. Figure 35 shows the Help menu.

Figure 35: The Help menu.

## Hugin Web Site

From the Help menu you can select the Hugin Web Site item. This opens your registered browser and takes you to the Hugin WWW pages (http://www.hugin.dk).

## Influence Diagram

An influence diagram is a Bbn extended with decision facilities (decision nodes and utility nodes).

An influence diagram cannot contain continuous chance nodes.

An influence diagram should be constructed so that one can see exactly which variables (represented by discrete chance nodes) are known at the point of deciding for each decision node. If the state of a chance node will be known at the time of making a decision, this will (probably) have an impact on what the decision maker should do. Thus, one must add a link from the chance node to the decision node. If the state of a chance node will be known before some given decision, and this chance node has impact on another chance node which is also known before the decision, only the last chance node needs to have a link to the decision node. That is, there only needs to be a directed path from a chance node to a decision node if the chance node is known before the decision is made.

In an influence diagram, there must also be an unambiguous order among the decision nodes. That is, there can be only one sequence in which the decisions are made. In the same way as when defining that a chance node will be known before a decision is made, we add links to show which decisions have already been made when a specific decision is made. Again there only need to be a directed path from one decision node to the next one in the decision sequence.

If the influence diagram is not constructed correctly according to the rules stated above, the calculated expected utilities will (of course) not be correct.

When propagating, you can follow the expected utility of choosing each decision in the next decision node in the decision sequence either in the node list pane or by opening a monitor window for the decision node. The utilities shown in a decision node further down in the decision sequence should not be considered before all previous decisions have been made. This simply makes no sence.

## Information

The information function is activated either by selecting the Information item of the View menu or by pressing the Information tool button in the main window tool bar (see figure 36).

Figure 36: The Information tool button in the main window tool bar.

When the information function is activated, a dialog window appears with two possible tabs. The first tab is labeled "Compilation Log". Under this tab you can see the output comments generated during compilation. Figure 37 shows this tab.

Figure 37: The Compilation Log tab of the Information dialog window.

The second tab is labeled "DDE Connections". Here, you can see all DDE connections from your HUGIN network to other applications. In Figure 38 we see an example where the node C3 has a DDE link from one of its states to another application.

Figure 38: DDE Connections tab of the Information dialog window.

## Initialize

The initialize function is activated either by selecting the Initialize item of the Network menu or by pressing the Initialize tool button in the run mode tool bar (see figure 39).

Figure 39: The Initialize tool button in the run mode tool bar.

The initialize function retracts all findings entered in the current HUGIN network.

## Likelihood

See Enter Likelihood.

## Learning - Adaptation

The adaptation algorithm (sequential updating) will update the conditional probability distribution of a Bayesian belief network in the light of inserted and propagated evidence (i.e. experience). The adaptation algorithm only applies to the discrete chance nodes. The algorithm is useful when the graphical structure and an initial specification of the conditional probability distributions are present but the modelled domain changes over time, the model is incomplete, or the model simply does not reflect the modelled domain properly.

In this section we give a quick overview of sequentially update the conditional probability tables. It is assumed that the reader is familiar with the methodology of Bayesian belief networks and influence diagrams as well as usage of Hugin Runtime (the graphical user interface). The basic concept of Bayesian belief is described in basic concepts section. You can also learn more about influence diagrams in the same section. To get an introduction to Hugin Runtime refer to A Small Bayesian Belief Network.

The sequential updating also known as adaptation or sequential learning makes it possible to update and improve the conditional probability distribution for a domain as observation are made. Adaptation is especially useful if the model is incomplete, the modelled domain is drifting over time, or the model quite simple does not reflect the modelled domain properly. Note that the graphical structure and an initial specification of conditional probability distribution must be present prior to adaptation.

The adaptation algorithm implemented in Hugin is developed by Spiegelhalter and Lauritzen [Spiegelhalter&Lauritzen90]. See also [Cowel&Dawid92] and [Olesen et.al.92] for a more detailed mathematical description of the algorithm.

Spiegelhalter and Lauritzen introduced the notion of experience. The experience is quantitative memory which can be based both on quantitative expert judgment and past cases. Dissemination of experience refers to the process of calculating prior conditional distributions for the variables in the belief network. Retrieval of experience refers to the process of calculating updated distributions for the parameters that determine the conditional distributions for the variables in the belief network.

In short the adaptation algorithm will update the conditional probability distribution of a Bayesian belief network in the light of inserted and propagated evidence (i.e. experience). Note that adaptation can only be applied to discrete chance variables.

The experience for a given discrete chance node is represented as a set of experience counts Alpha0,...,Alphan-1, where n is the number of configurations of the parents of the node and Alphai > 0 for all i; Alphai corresponds to the number of times the parents have been observed to be in the ith configuration. However, note that the “counts” do not have to be integers – they can be arbitrary (positive) real number, thus the counts are only conceptual. The experience counts are stored in a table, experience table.

When an experience table is created, it is filled with zeros. Since zero is an invalid experience count, positive values must be stored in the tables before adaptation can take place. The adaptation algorithm will only adapt conditional distributions corresponding to parent configurations having a positive experience count. All other configurations (including all configurations for nodes with o experience table) are ignored. This convention can be used to turn on/off adaptation at the levee of individual parent configurations: setting an experience count to positive number will turn on adaptation for the associated parent configuration; setting the experience count to zero or a negative number will turn it off.

Experience tables can be deleted. Note that this will turn off adaptation for the node associated with the experience table and the initial conditional distribution will be equal to conditional distribution of the node at the deletion time.

The adaptation algorithm also provides an optional fading feature. This feature reduces the influence of past (and possibly outdated) experience in order to let the domain model adapt to changing environments. This is achieved by discounting the experience count Alphai by a fading factor Deltai, which is a positive real number less than but typically close to 1. The true fading amount is made proportional to the probability of the parent configuration in question. to be precise: if the ith parent given the propagated evidence is pi, then Alphai is multiplied by (1-pi)+piDeltai) before adaptation takes place. Note that the experience counts corresponding to parent configurations that are inconsistent with the propagated evidence (i.e. configuration with pi = 0) remain unchanged. The fading for a given discrete chance node is stored in a table namely fading table, where each value in the table corresponds to a parent configuration. The fading factor Deltai can be set to 1: this implies that cases are accumulated (that is, no fading takes place). Setting Deltai to a value greater than 1 or less than or equal to 0 will disable adaptation for the ith parent configuration (just as setting Alphai to an invalid value will).

## Learning - EM

This section describes the feature of using data (i.e. a set of cases) to "learn" the conditional probability distributions when only the graphical structure is given. This is known as batch learning. Note that if the initial conditional probability distributions are also given it is still possible to use batch learning.

Batch learning requires that all data is available when the learning process starts, whereas sequential learning allows the knowledge to be updated incrementally but sequential learning requires that an initial assessment of the conditional probabilities is given whereas batch learning only requires the graphical structure. The batch learning method currently implemented in Hugin is called EM-algorithm or EM-learning and was developed by Lauritzen [Lauritzen95] see also [Cowel&Dawid92].

A case is an assignment of values to some or all the nodes of a domain. If values have been assigned to all nodes, the case is said to be complete; otherwise, it is said to be incomplete. The data used by the learning algorithm is comprised of a set of cases. The cases are numbered sequentially from 0 to N-1, where N is the total number of cases.

Although the learning algorithm currently implemented in Hugin cannot learn conditional distributions for continuous nodes, such nodes can contribute to the beliefs of the discrete (chance) nodes. Hence, the Hugin also provides functions for entering and retrieving values for continuous nodes.

Before learning can take place, in addition to the data set, the set of nodes for which conditional probability distributions should be learned must be specified. This set is specified as the set of nodes having experience tables (described in previous section). The input to the learning algorithm is the case data; this set of cases must be non-empty. Note that if the domain is an influence diagram model, then the domains decision nodes must be instantiated in all cases.

The learning algorithm needs to do inference, so the domain must be compiled before the learning algorithm is called. If successful, the procedure will update the conditional probability and the experience table for each node of the domain that has an experience table. Moreover, the inference engine will be reset and use the new conditional probability.

If the contents of the experience tables are all zeros, then the algorithm will compute the best ("maximum likelihood") conditional probability tables, assuming that any table is valid (i.e. there are no restrictions on the form of the tables). If the contents are not all zeros, then the product of the experience table and the conditional probability tables is used to form counts ("prior counts") that will be added to those derived from the data set. This is known as "penalized EM".

The starting point or the EM algorithm is the conditional probability tables specified prior to calling the algorithm, assuming that the domain has been compiled with these tables. If no table has been specified, uniform distributions are assumed. Sometimes it is desirable to enforce zeros in the conditional probability tables for the configurations that should be impossible (i.e. having zero probability).

The EM algorithm performs a number of iterations. For each iteration the logarithm of the probability of the case data given the current joint probability distribution is computed. This quantity is known as the log-likelihood, and the EM-algorithm attempts to maximize this quantity. The EM algorithm terminates when the relative difference between the log-likelihood for two successive iterations is sufficiently small. I.e. when the relative difference between the log-likelihood for two successive iterations becomes less than tolerance, which must be a positive number. By default the initial value of tolerance is 10-4.

## Link

A link in a Bbn defines a causal arrow from one chance node (discrete or continuous) to another.

In an influence diagram a link can mean one of three things:

1. It can be a causal arrow as in a pure Bbn. This is the case, when the arrow goes from a chance node or decision node to a chance node.
2. It can define the utility function to depend on a chance node or a decision node. This is the case if the arrow goes from a chance node or decision node to a utility node.
3. It can define the order of the decision nodes (See the Decision Node section for more about the order of decision nodes). This is the case if the arrow goes from a chance node or decision node to a decision node.

A link can be established in edit mode by activating the link tool and dragging a line from one node to another.

## Link Tool

The link tool can be activated either from the Link Tool item of the Edit menu or from the link tool button in the edit mode tool bar (the button shown in figure 40).

Figure 40: The link tool button from the edit mode tool bar.

When the link tool is activated (when the link tool button is pressed) you can drag a link from one node to another in the network pane: Press the left mouse button somewhere within one node and drag the cursor into another node. Then, release the mouse button again. When you have created the link, the select tool is normally activated again. If you want to keep the link tool activated (to create a series of links) hold down the SHIFT key while creating the link.

## Lock Display of Evidence

The lock display of evidence function can be activated either from the Lock Evidence item of the View menu or from the lock evidence button in the run mode tool bar (the button shown in figure 41).

Figure 41: The lock evidence button from the run mode tool bar.

The lock display of evidence function is meant to allow the user to view the likelihood he/she has entered in a node. Normally (when the lock display of evidence is disabled), the monitors and the node list pane will for all nodes show the belief of a node being in each of its states. When the lock display of evidence function is activated (when the lock display of evidence tool button is pressed) the monitors and node list pane will show the entered findings for all nodes having entered findings. This is most relevant for nodes having likelihood entered.

## Lock Scrolling in Node Edit Pane

The lock scrolling in node edit pane function can be activated either from the Lock Edit Window item of the View menu or from the lock node edit pane button in the edit mode tool bar (the button shown in figure 42).

Figure 42: The lock node edit pane button from the edit mode tool bar.

The lock node edit pane function helps the user when the cpt or utility table of a node get too wide to be kept inside the node edit pane. If lock node edit pane is disabled, when you scroll to the right, the left most column showing parent names and state names of the currently selected node will disappear. When lock node edit pane is activated, the left most column is cut of and placed in the left side of the node edit pane - even when the user scrolls the left most columns of the cpt/utility table out of view.

## Main Window

The main window is build up to contain a series of network windows each showing an open Hugin Bbn. The main window has a menu bar, a tool bar, and a pane which can contain a number of network windows. Below this pane is the status bar which contains the mode indicator which shows different information about the currently active network window.

Figure 43 shows the main window.

Figure 43: The main window

## Manually Specify Table

Specifying the table of a discrete chance node or utility node manually as an alternative to specifying expressions allows the user to edit each number in the node table directly. The table is shown in the node edit pane.

You can select to specify a table manually by selecting the Manual item of the Table menu.

## Mode Indicator

The mode indicator is found in the status bar of the main window. It indicates if the currently active network window is in edit mode or run mode. In figure 44 and 33 the mode indicator indicates edit mode and run mode, respectively.

Figure 44: The red circle shows the mode indicator in the status bar of the main window. Here, it indicates edit mode.

Figure 45: The red circle shows the mode indicator in the status bar of the main window. Here, it indicates run mode.

## Monitor Windows

In run mode you can open monitor windows for all or some of the nodes. This is done by selecting the nodes and then choosing the Show Monitor Windows item from the View menu. You can also choose the Show Monitors item from the network pane menu which is activated when you press the right mouse button somewhere in the network pane while working in run mode.

There are three types of monitor windows (see figure 46, figure 47, and figure 48) - one for each of the node types: discrete chance node, continuous chance node, and decision node. You cannot open a monitor window for a utility node.

Figure 46: A monitor window for a discrete chance node

Figure 47: A monitor window for a continuous chance node

Figure 48: A monitor window for a decision node

The monitor windows show (monitor) the calculated results for a node:

- Discrete chance nodes: The probability of each state.
- Continuous chance nodes: The mean, variance (SD), and the pdf graph.
- Decision nodes: The expected utility of each action.

Monitor windows for continuous chance nodes can open with or without showing the graph display below the pane showing mean and variance (depending on the settings in Network Properties as described later). You can open and close it by clicking the small button on the right of the mean and variance. You can chose different end points as the mean plus/minus an integral multiple of the variance from the two drop down lists below the pane containing the graph.

On the right side of the graph there is a slider which can be used to zoom in on the x-axis to spot local peaks on the graph. Just below this slider is a button which should be pressed after each propagation to update the graph if auto update of graphs is not enabled. Hugin does not automatically update the graphs because this could take a very long time on large Bbns.

You can customize the monitor windows to your needs in the Monitors tab of the Network Properties dialog box. Figure 49 shows the Monitors tab.

Figure 49: The Network Properties dialog box showing the Monitors tab.

You can set the monitors to show at most a certain number of states in the Monitor States group box. For continuous chance nodes, you can specify if you always want the monitor to open with the graph pane and you can specify the end points (in multiples of the variance) of the graph.

You can also specify the graph precision. Normally, you would want the graph as precise as possible but if you have a large network with many continuous chance nodes and poor performance, you might save some time if you decrease graph precision.

## Network Menu

The Network menu (shown in figure 50) is found in the menu bar of the main window.

The Network menu contains items covering different items for activities in a Hugin Bbn.

Figure 50: The contents of the Network menu.

## Network Pane

The network pane is the part of a network window which contains the graph of the current network. It displays the relationship between the nodes represented by links. The network pane is visable in both edit mode and run mode.

Figure 51 shows the network pane containing a Bbn.

Figure 51: The network pane.

## Network Properties

Network properties can be viewed by selecting the Network Properties item of the network menu. It allows you to set up the Hugin Runtime tool as suits you best.

In the network properties dialog box are six tabs covering different parts of the tool:

- Auto Propagation
- Compilation
- Description
- Display
- Groups and Colors
- Monitors

All these tabs except for the Description tab are covered elsewhere in the manual (under their name). The Description tab only contains a simple text editor pane where you can describe you Bbn for documentation purposes. The network properties dialog box and the Description tab are shown in figure 52.

Figure 52: The network properties dialog box with the Description tab currently chosen.

If you are editing or running a network (Bbn or influence diagram), you can view the network description fast by moving the mouse cursor into the network pane and pressing SHIFT + right mouse button.

## Network Window

Within the main window you can open a series of network windows. The network windows each allow you to edit or run a Hugin Bbn.

The network windows can have two different looks depending on the mode you are currently working in. If you are constructing (editing) the Bbn, the network window is in edit mode. If you are using the Bbn for calculations, the network window is in run mode.

## New

The new function can be activated by selecting the New item of the File menu or by pressing the New tool button (see figure 53) in the main window tool bar.

Figure 53: The new button from the main window tool bar.

The new function opens a new clean network window where you start constructing a new Hugin Bbn.

## Node

The nodes are one of the basics in constructing a Hugin Bbn or influence diagram. Currently, Hugin has four types of nodes different in their look and semantics.

- Discrete Chance Nodes - represent random variables with a discrete finite state space.
- Continuous Chance Nodes - represent random variables with a continuous infinite satet space having a Gaussian normal distribution.
- Decision Nodes - represent decisions or actions with a discrete state space.
- Utility Nodes - represent the utility function one or more decisions are to be compared on.

The graph of a Bbn/influence diagram consist of the nodes and the links.

## Node Edit Pane

The node edit pane is used in the edit mode network window. It displays the table of the currently selected node if it has one (discrete chance nodes and utility nodes). Else, for decision nodes it shows the list of decisions and for continuous chance nodes, the distribution function specified by mean and variance for each configuration of the discrete parents.

Figure 54 shows a node edit pane of a discrete chance node.

Figure 54: The node edit pane.

## Node Label

The node label is used by Hugin to display as the label on the nodes. It does not need to be unique in the actual network. Initially, a node has no node label and Hugin uses the node name as the label. If you should want to assign a new node label to a node, it can be done in edit mode in the node edit pane or in the node properties dialog box.

You should be aware of the different between the node label and the node name.

## Node List Pane

The node list pane is used in the run mode network window. It displays the nodes of the current network in a collapsable list. The node list pane is placed to the left of the network pane.

Figure 55 shows a node list pane of a Bbn.

Figure 55: The node list pane.

When you expand a node in the node list, you can see the calculated results of the last propagation in a format similar to monitor windows.

## Node Name (Node Identifier)

The node name (or node identifier) is a unique name which all nodes must have. Initially, Hugin assigns a name to a new node. If you should later want to change this name, it can be done in edit mode in the node edit pane or in the node properties dialog box.

You should be aware of the different between the node name and the node label.

## Node Properties

You can open the node properties dialog box by selecting a node and then choosing the Node Properties item of the Edit menu. You can also just select a node and somewhere within the network pane press the right mouse button. This opens a menu from which you can choose the Node Properties item.

Figure 56 shows the node properties dialog box. It is organized in three tabs which are documented separately:

- Node tab
- States tab
- Table tab

Figure 56: The node properties dialog box showing the Node Tab.

## Node Tab

The Node Tab of the Node Properties dialog allows the user to edit different attributes of the nodes of a Hugin domain. The Node Tab is shown in figure 203.

Figure 203: The node properties dialog box showing the Node Tab.

In the top of the Node tab you can specify the node name, node label, node type, and group of the selected node (name and label can only be specified in edit mode. Below these fields, you can also specify a description for the node. The node type can only be specified for discrete chance nodes and decison nodes.

## Node Type

To be able to use nodes as arguments in expression functions, node types are introduced for discrete chance nodes and decision nodes. Below are listed the different node types:

- Labelled - Each state has a label. This is similar how all discrete nodes looked in old versions of Hugin.
- Boolean - Has two states: false and true.
- Numbered - Each state has a numeric value. This means that you can make expressions define the sum of two numbered nodes. You can also specify standard discrete distribution functions for numbered nodes if you fit the state values to what is required for the distribution function (typically: 0, 1, 2,...).
- Interval - Each state represents an interval on the real axis. The entire set of states span a continuous interval on the real axis. This is used to approximate a continuous random variable. You can specify standard continuous distribution functions for interval nodes, or you can use them in arithmetic functions.

You specify the node type of a node by activating the node so that it is shown in the node edit pane. Then, select the node type from the node type drop down box in the top of the node edit pane. You can also select the node type in the Node tab of the Node Properties dialog.

## Open

The open function is activated either by selecting the Open item of the File menu or by pressing the open button from the main window. Figure 57 shows the open tool button.

Figure 57: The open button from the main window tool bar.

The open function in Hugin is like the open function in most other applications: It opens a saved Hugin network. It can open files of both hkb format (compiled Hugin network format) and net format (standard Bbn description format).

## Options Menu

The Options menu is found in the menu bar of the main window. It contains items which let you customize Hugin in different ways.

Figure 58: The options menu from the main window.

## Page Setup

The page setup function is a standard windows application function allowing the user to set the print options (size of paper, direction of the printed figure (portrait/landscape), and the margin widths).

## Paste

You can activate paste either by selecting the Paste item from the Edit menu or by pushing the paste button from the main window tool bar. Figure 59 shows the paste button.

Figure 59: The paste button from the main window tool bar.

The paste function lets you insert what is currently stored on the clip board. In edit mode you can cut or copy a sub network in the network pane and afterwards paste it in the same network pane or in the network pane of another Hugin network (Bbn/influence diagram).

## Preferences

The preferences dialog box is opened from the Options menu. It allows the user to customize the Hugin user interface. Figure 60 and figure 61 shows the preferences dialog box with each of the two tabs chosen.

Figure 60: The preferences dialog box with the General Options tab chosen

In the General Options tab (figure 60) there are two groups of controls. In the first group (the General Options group), you can specify how many files you want to be shown in the recently used files list in the File menu. Below, you can specify if and how often you want to autosave. You can also specify different sound effects and if you want shadows behind the nodes in the network pane.

In the second group (the Drawing Pane group) you can specify how sensible you want the mouse to act in the edit mode network pane (the drawing pane).

Figure 61: The preferences dialog box with the Belief Bar Colors tab chosen

In the Belief Bar Colors tab (figure 61) you can change the default colors for belief, finding, inconsistency, likelihood, and locked findings used in the node list pane and the monitor windows.

Figure 62 shows the color select dialog window which appears when you click any of the buttons in the Belief Bar Colors tab.

Figure 62: The color selection dialog box

## Print

Hugin has print facilities to print out a network in three different forms: You can print the network graph, the node table of a selected node, and the probabilities shown in the network in run mode.

You can set the print options before printing using the page setup function.

## Print Network

The print network function can be activated either by selecting the Print Network item from the File menu or by pressing the print network button (see figure 63) in the main window tool bar.

Figure 63: The print network button from the main window tool bar.

The print network function prints the network graph of the currently active network window using a standard print dialog.

## Print Node Table

The print node table function can be activated either by selecting the Print Node Table item from the File menu (only in edit mode) or by pressing the print node table button (see figure 64) in the edit mode tool bar.

Figure 64: The print node table button from the edit mode tool bar.

The print node table function prints the node table (cpt or utility table) of the currently selected node using a standard print dialog.

## Print Probabilities

The print probabilities function can be activated either by selecting the Print Probabilities item from the File menu (only in run mode) or by pressing the print probabilities button (see figure 65) in the run mode tool bar.

Figure 65: The print probabilities button from the run mode tool bar.

The print probabilities function prints the results calculated for a series of nodes. When you activate the print probabilities function, a dialog box appears asking you to specify the nodes you want in the printed node series. This is followed by a standard print dialog.

## Propagation

One of the propagation functions can be activated either by selecting one of the Prop items in the Network menu or by pressing one of the four propagation buttons in the run mode tool bar. Figure 66 shows these propagation buttons. You can also specify Hugin to use auto propagation which will make it propagate every time you enter new evidence.

Figure 66: The four propagation buttons from the run mode tool bar. Propagation methods for these buttons are (from left to right): sum normal, max normal, sum fast retract, and max fast retract.

The propagation function is used to make Hugin update all probabilities, distribution functions, and expected utilities of the discrete chance nodes, the continuous chance nodes, and the decision nodes, respectively.

There are four different propagation methods: Sum normal, max normal, sum fast retraction, and max fast retraction. The most commonly used method is the sum normal which updates all probabilities according to the entered evidence. The other methods have special purposes which you can read about in their description sections.

## Propagation Indicator

The propagation indicator is found in the status bar of the main window. It indicates if the currently active network window is using auto propagation and which propagation method is used. If auto propagation is enabled, the indicator is on. Otherwise, the indicator is greyed. If the indicator is on, it will show the symbol for the chosen propagation method. In figure 67 the propagation indicator is on and it shows that the chosen propagation method is sum normal.

Figure 67: The red circle shows the propagation indicator which is on (indicating auto propagation). It also shows that the chosen propagation method is sum normal.

## Prop Max Fast Retract

The prop max fast retract propagation is activated either by selecting the Prop Max Fast Retract item of the network menu or by pressing the corresponding button in the run mode tool bar (see figure 68). If you are using auto propagation, you can specify Hugin to use this propagation method.

The prop max fast retract propagation method can be used in Bbns containing only discrete chance nodes. It is similar to the max normal method except that it shows the nodes which have recieved evidence differently. Instead of showing the values of the states of the node which has recieved evidence, the values of the states are shown as if this node had not recieved evidence. That is, the values of the node being in each of its states given the evidence entered in all other nodes. To indicate that the node has in fact recieved evidence, the belief bars use the color code for evidence (default: Red).

This propagation method can be used to check if the evidence corresponds to (one of) the most likely configuration(s) or if the evidence suggests that one of the less likely configurations has been observed (if a state of a node has been observed which does not have the value: 100).

Figure 68: The prop max fast retract button from the run mode tool bar.

## Prop Max Normal

The prop max normal propagation is activated either by selecting the Prop Max Normal item of the network menu or by pressing the corresponding button in the run mode tool bar (see figure 69). If you are using auto propagation, you can specify Hugin to use this propagation method.

The prop max normal propagation method can be used in Bbns containing only discrete chance nodes to find states belonging to the most probable configuration (a configuration is a list of states (a1, a2,..., an) of the list of all nodes in the Bbn (A1, A2,..., An)).

If a state of a node belongs to the most probable configuration it is given the value 100. All other states are given the relative value of the probability of the most probable configuration they are found in compared to the most probable configuration. That is, assume a node N has two states a and b, and b belongs to the most probable configuration of the entire Bbn which has the probability 0.002. Then, b is given the value 100. Now, assume that the most probable configuration which a belongs to has probability 0.0012. Then, a is given the value 60.

The prop max normal button which is found in the network window tool bar in run mode is shown in figure 69.

Figure 69: The prop max normal button from the run mode tool bar.

## Prop Sum Fast Retract

The prop sum fast retract propagation is activated either by selecting the Prop Sum Fast Retract item of the network menu or by pressing the corresponding button in the run mode tool bar (see figure 70). If you are using auto propagation, you can specify Hugin to use this propagation method.

The prop sum fast retract propagation method can be used in Bbns containing only discrete chance nodes. It is similar to the sum normal method except that it shows the nodes which have recieved evidence differently. Instead of showing the true probability of the states of the node, the probability of the states are shown as if this node had not recieved evidence. That is, the probability of the node being in each of its states given the evidence entered in all other nodes. To indicate that the node has in fact recieved evidence, the belief bars use the color code for evidence (default: Red).

This propagation method can be used to check if the evidence entered in a node meets the probabilities of the evidence or if there are signs of some kind of conflict (the evidence entered is one of the most unlikely states of the node).

Figure 70: The prop sum fast retract button from the run mode tool bar.

## Prop Sum Normal

The prop sum normal propagation is activated either by selecting the Prop Sum Normal item of the network menu or by pressing the corresponding button in the run mode tool bar (see figure 71). If you are using auto propagation, you can specify Hugin to use this propagation method.

The prop sum normal is the most commonly used propagation method. It updates all probabilities, distribution functions, and expected utilities of the discrete chance nodes, the continuous chance nodes, and the decision nodes, respectively, according to entered evidence.

The prop sum normal button which is found in the network window tool bar in run mode is shown in figure 71.

Figure 71: The prop sum normal button from the run mode tool bar.

## Recently Used Files

The recently used files are found in the last part of the File menu - just above the Exit item.

This list of Hugin network files is a common Windows facility which enables the user to open a recently used network faster than using the standard open function. Selecting the menu item for one of the recently used files opens this network file in a new network window.

In the preferences dialog box, you can specify how long this list should be.

## Recompile

The recompile function is activated from run mode either by pressing the compile tool button (see figure 72) or by selecting the Recompile item of the Network menu.

Figure 72: The compile tool button from the run mode tool bar.

You can use the recompile function to make a new compilation when a network has been saved with evidence and reloaded to get the initial beliefs (if a network was saved with evidence, the shown beliefs will be those calculated with this evidence.

See also Compile.

## Retract Node

The retract node function can be activated either by selecting the Retract Node item of the Netork menu or by double clicking in the node list pane at the currently selected state of the node you want retracted.

You retract a node when you have entered evidence into this node and want to eliminate this evidence from the node again.

## Run Mode

When you test or use your HUGIN network for calculations, you are running in run mode. In figure 73 you can see a network window of a HUGIN network running in run mode. In run mode, the network window is split up in a node list pane on the left and a network pane where the graph describing the network is shown. In the node list pane you can view the states of the nodes and their beliefs (expected utility for decision nodes and mean/variance for continuous chance nodes). You view the states of a node by expanding it.

Figure 73: The network window of a HUGIN network running in run mode.

You go from edit mode to run mode by clicking the compile button in the tool bar of the edit mode network window or by selecting the Compile item of the network menu. Figure 74 shows the compile button.

Figure 74: The compile tool button from the network window tool bar.

## Save

The save function is activated either by selecting the Save item of the File menu or by clicking the save button in the main window tool bar. Figure 75 shows the save button.

Figure 75: The save button from the main window tool bar.

When the save function is activated the user is able to save the currently active Hugin network in hkb format (compiled Hugin network format) through a standard Windows save dialog.

If you want to save your network in a new file you should use the save as function. You can also save it in net format (ASCII format which can be read in an editor). Then, you should use the save net file function.

## Save As

The save as function is activated by selecting the Save As item of the File menu.

The save as function is similar to the save function except that it always asks for a file name to save the network in (the save function just saves in the file the network was saved in earlier.

## Save Net File

The save net file function is activated by selecting the Save Net File item of the File menu.

A net file is an ASCII file containing a network (Bbn/influence diagram) in a format compatible with the Bayesian Network Interchange Format (a standard format which all Bbn tools should use).

## Select All

The select all funtion is activated by selecting the Select All item of the Edit menu.

The select all function selects all nodes in the network pane. This allows you to do certain actions on all nodes at once in stead of doing it on one at a time.

## Select State

The select state function is activated by clicking once in the node list pane below a node to the left of a state with the mouse cursor. You can also activate it by double clicking a state in the node list pane or in a monitor window.

The select state function is a special case (the most common case) of entrance of likelihood. What you actually do is entering the fact that one state now has probability 1 and all other states have probability 0.

## Select Tool

The select tool is activated either by selecting the Select Tool item of the Edit menu or by clicking the select tool button in the tool bar of the edit mode network window. In run mode, the select tool is always active. Figure 76 shows the select tool button.

Figure 76: The select tool button from the edit mode tool bar.

The select tool allows you to select one or more nodes in the network pane. You select a single node by clicking it or dragging a rectangle around it when the select tool is active. You can select a series of nodes by dragging a rectangle around the nodes you want selected. You can also add more nodes to the currently selected series of nodes by holding down the SHIFT key while selecting more nodes.

## Show Last Error

The show last error function is activated by selecting the Show Last Error item of the View menu.

If you get an error in Hugin, you can use this function to view the error message and a description of the error in a small dialog box.

## Size Bar Length

You can resize the bar length of the bars in the node list pane. This can be helpful if you do not want to use to much space for the node list pane. You can do this simply by dragging the size bar in the top of the node list pane. Figure 77 shows the size bar. You can also select the Size Bar Length item of the View menu.

Figure 77: The size bar in the top of the node list pane.

## Size Node Edit Pane

You can resize the node edit pane by dragging the horizontal separator between the node edit pane and the network pane. You can also select the Size Node Edit Window of the View menu.

## Size Node List Pane

You can resize the node list pane by dragging the vertical separator between the node list pane and the network pane. You can also select the Size Node List Window of the View menu.

## Snap to Grid

See Align.

## States Tab

The States tab of the Node Properties is used to specify the states of the current node.

Figure 205 shows the States tab. Here, you can specify the state names, state values, or state intervals depending on the type of the node you are currently editing.

- If the type is "Labelled", you can type in anything as the state label.
- If the type is "Boolean", you cannot change the two states "false" and "true".
- If the type is "Numbered", you can type in a number. The numbers must form an increasing sequence.
- If the type is "Interval", you can type in intervals in the format: "<number> - <number>".

You type in the state label/value/interval in the edit box below the states list and press "Rename

If you are editing an interval node, and you change a state interval, the neighboring states will automatically be fitted to your change so that there are no gaps between state intervals. You specify that an interval should represent all the values greater than a particular number by using "infinity" or "inf" as the end point of the interval. Eg: "10-inf". You can also use "-infinity" or "-inf".

If you are specifying an interval and you only type in one number, the system will use the end point of the previous state together with the number to form an interval. This can make interval specification faster.

Figure 205: The node properties dialog box showing the States tab of a node having type "Numbered".

## Table Menu

The Table menu is found in the menu bar of the main window. It contains items to help you specify a node table.

Figure 206: The node properties dialog box showing the States tab of a node having type "Numbered".

## Table Tab

The Table tab of the Node Properties is used to specify different aspects about how you want to edit node tables.

Figure 204 shows the Table tab. In the top you find the Discrete Parents list. Here, you can define the order of the discrete parents as the appear in the table shown in the node edit pane.

For discrete chance nodes and utility nodes you can choose between editing the probability- or utility table either manually (you type in each and every number in the table) or you can specify expressions. This choise can be made in the select buttons below the Discrete Parents list.

Figure 204: The node properties dialog box showing the Table tab.

If you choose to edit expressions, you can select a number of Expression Table Nodes. These are discrete parents that you will probably node use in your expressions. In stead, you want to specify an expression for each configuration of these nodes - if you do not specify any expression table nodes, you need only specify one expression for the current node table.

## Tile Windows Horizontally

The tile windows horizontally function can be activated from the Tile Horizontal item in the Window menu or from the tile windows horizontally button in the main window tool bar (the button shown in figure 78).

Figure 78: The tile windows horizontally tool button from the main window tool bar.

The tile windows horizontally function arranges the network windows in the main window below each other.

## Tile Windows Vertically

The tile windows vertically function can be activated from the Tile Vertical item in the Window menu or from the tile windows vertically button in the main window tool bar (the button shown in figure 79).

Figure 79: The tile windows vertically tool button from the main window tool bar.

The tile windows vertically function arranges the network windows in the main window below each other.

## Toolbar Setup

If you do not want the default main window tool bar provided by Hugin, you can customize it yourself by selecting the Toolbar Setup item of the Options menu. This opens the tool bar setup dialog box shown in figure 80.

Figure 80: The tool bar setup dialog box which enables the user to customize the main window tool bar.

You add an extra tool button to the main window tool bar by selecting it in the Available buttons list and pressing the Add button. You remove a button from the current tool bar by selecting it in the Toolbar buttons list and pressing the Remove button. By pressing Reset, you get back to the default tool bar setup.

## Update Monitor Graphs

You can update montor graphs either by selecting the Update all Monitor Graphs item of the View menu or you can click the update monitor graph buttons in each monitor window showing a graph (this can only be continuous chance nodes). An update graph button is shown in figure 81.

Figure 81: The update monitor graph button which can be found lower right corner of a monitor window showing the graph of a continuous chance node.

You update the monitor graphs when you have propagated a Bbn containing continuous chance nodes with new evidence. You can specify Hugin to automatically update the graphs but in general (at least for large Bbns) you should disable automatical update because it can be very time consuming.

## Utility Tool

The utility tool can be activated either from the Utility Tool item of the Edit menu or from the utility tool button in the edit mode tool bar (the button shown in figure 82).

Figure 82: The utility tool button from the edit mode tool bar.

When the utility tool is activated (when the utility tool button is pressed) you can place a utility node in the network pane: Simply click the mouse somewhere within the network pane. When you have placed the utility node, the select tool is normally activated again. If you want keep the utility tool activated (to create a series of nodes) hold down the SHIFT key while placing a node.

## Utility Node

A utility node represents an addendum of the utility function in an influence diagram. Thus, the utility function is the sum of all the utility nodes in the influence diagram.

Each utility function has assigned a utility table which specifies the utility of each configuration of the parents of the utility node (in an influence diagram, a link from a decision node or a discrete chance node represents the decision node/chance node to contribute directly to the utility function).

A utility node can be added to the current network (which will then be an influence diagram) by activating the utility tool and clicking somewhere in the network pane.

## Utility Table

The utility table is very similar to the conditional probability table.

The utility table is the table of utilities found in the node edit pane when the node specified by the node name and node label (the currently selected node) is a utility node.

Only if you have chosen to specify the table manually (alternative to using expressions), you can see the utility table. Otherwise, you see the table of expressions specifying the utility table.

The utility table specifies a utility function. For each configuration of the states of the parents, the utility table has an entry specifying a utility value of this configuration. Figure 83 shows the utility table of a utility node with two parents (Active and Color).

Figure 83: The utility table of a utility node with two parents (Active and Color).

Each numeric value in the utility table is the utility of the parent nodes being in the states found in the top of the actual column.

You can change a specific numeric value by selecting it with the mouse cursor and typing in a new value from the keyboard.

## View Menu

The View menu is found in the menu bar of the main window. It contains items which allow the user to change the view of the currently active network. The View menu is shown in figure 84.

Figure 84: The View menu of the main window.

## Window List

In the bottom of the Window menu you can find a list of the currently open network windows. If you select one of these windows, it will be the currently active window and appear on top of all other network windows.

## Window Menu

The Window menu is found in the menu bar of the main window. It contains items which allow the user to arrange the currently active network windows within the main window. The Window menu is shown in figure 85.

Figure 85: The Window menu of the main window.

## Zoom

You can zoom in or out on the currently active network using the Zoom sub items found in the Network menu of the main window.

This function is useful on large networks to get a better view of the whole network.

Figure 86: The Zoom sub items of the Network menu of the main window.

##

Back