# Node Table Tutorial¶

This tutorial explains the functionalities of node tables. To each chance node in a Bayesian network and each node in a (limited-memory) influence diagram is assigned a table, specifying a function associated with the node. Each decision node has a table specifying the initial policy for the decision variable represented by the node. These tables are referred to as node tables. The types of the tables differ depending on the types of the nodes.

The HUGIN Graphical User Interface provides a number of powerful features for displaying node tables, including resizing, collapsing selected sets of columns, graphics display modes, etc. Furthermore, the user can choose between two different ways of organizing the tables:

• Framed tables (Figure 1)

• Tabbed tables (Figure 2)

The framed mode has the advantage that several tables can be viewed at once, whereas the tabbed mode is a lot more compact (with several open tables) and it is easier to navigate the tables. The preferred table mode can be set in the Preferences, and it can be changed by selecting the “Toggle Table Mode” item in the View Menu of a table.

The probabilities and utilities of discrete chance nodes and utility nodes, respectively, can be specified manually (i.e., directly through click-and-type operations) or they can be specified indirectly through specification of powerful expressions, which (if appropriate) can save a lot of work. The initial policy for a decision node can also be specified both manually and using expressions.

When working in Edit Mode with the Tables Pane open, the currently selected nodes will have their tables displayed in the Tables Pane.

## Modes¶

For discrete chance nodes, discrete decision nodes, and utility nodes the node table has two different modes:

• Manual mode in which the numbers (probabilities or utilities) can be specified manually. This is the default mode, see Figure 1.

• Expressions mode in which the numbers can be specified through one or more mathematical expressions, see Figure 2.

To switch between the two modes, select the appropriate item in the Functions menu of the node table, see Figure 3.

In Expressions mode there are one or more editable text fields in which expressions can be specified (one in each text field) either manually or through the Expression Builder. The number of text fields available depends on the number of states of the model nodes. If no model nodes have been specified, there will only be one text field (i.e., the same expression is used for all parent configurations).

## Types of Tables¶

For discrete chance nodes this function expresses a conditional probability distribution over the states of the node for each configuration of the states of the parents of the node, which are also discrete chance nodes. The conditional probability distribution (or marginal probability distribution in case of no parents) is represented as a conditional probability table (abbreviated CPT). Figure 4 shows an example of a CPT for the node Grass with parents Rain and Sprinkler.

For each continuous chance node with discrete parents I and continuous parents Z, the function expresses a (one-dimensional) Gaussian distribution conditional on the values of the parents:

$P(Y|I = i, Z = z) = \cal{N}(\alpha(i) + \beta(i)^\tau z, \gamma(i))$

Note that the mean depends linearly on the continuous parents and that the variance does not depend on the continuous parents. However, both the linear function and the variance are allowed to depend on the discrete parents. (These restrictions ensure that exact inference is possible.) Thus, for each configuration of the discrete parents, a mean and a variance parameter must be specified, as well as a regression parameter for each continuous parent. Figure 5 shows the table for the continuous node Dust Emission (Emission) with discrete parents Burning Regimen (Burn) and Waste (Waste Type), and the continuous parent Filter Efficiency (Efficiency).

For each utility node, the function associated with the node expresses a utility function, where a utility value has to be specified for each configuration of its parents, which can be discrete chance and decision nodes. Figure 6 shows the table for the utility node Utility with the discrete chance node Oil and the discrete decision node Drill as parents.

For each decision node is associated a decision table, which is an encoding of the initial policy for the decision node. Figure 7 shows the table of a decision node, D, with decision options “drill” and “don’t drill”.

The Edit menu provides the following functionalities (see Figure 8):

• Copying the selected cells of the table. Several cells can be selected by dragging the mouse cursor (i.e., move the mouse while keeping the left mouse button down). The selected cells will be highlighted.

• Pasting what has previous been copied. The destination cells of the paste operation are given as those covered by the rectangle extending right and down from the cell selected (i.e., the selected cell defines the upper-left cell of the destination cells).

• Renaming / relabeling of the node associated with the table. When selected, this menu item makes a dialog box appear through which the name and label of the node can be changed. Note that this dialog box is also available by right-clicking the title bar of the table.

• Normalizing the probability distributions of a CPT (i.e., making the probabilities in each distribution - one for each parent configuration - sum to 1).

• Resetting the values of all cells in the table to their default values (1 for CPTs and fading tables, and 0 for utility and experience tables). (See the section on Learning - Adaptation for a description of experience and fading tables.)

• Randomizing the values of all cells of a CPT (i.e., assigning random values between 0 and 1 to all probabilities in each distribution, making sure that the values for each distribution sum to 1).

• Creating an identity table the values of each cell on the diagonal is assigned a value of 1 and every other cell is assigned a value of 0.

Please note that the copy and paste operations also work across applications (e.g., to/from the HUGIN node table from/to Excel, Word, Emacs, etc.).

The Functions menu provides the following functionalities (see Figure 9): Creating and deleting experience and fading tables is performed via the Experience and Fading submenu (see Figure 10). (See the section on Learning - Adaptation for a description of experience and fading tables.) Specifying expressions (models) for how to generate the values of the cells of CPTs and utility tables. See section Expressions for details. Setting the type of the node to one of Labelled, Boolean, Numbered, or Interval if the node is a discrete chance node or a discrete decision node. See section Node Type for details on node types. Exporting the table (i.e., the values of the cells of the table) to either an x-delimited text file, where ‘x’ can be ‘,’, ‘<space>’, or ‘<tab>’.

The View menu provides the following functionalities (see Figure 11):

Below are some test paragraphs.

• Selecting display mode. A number of different modes for displaying the numbers of the table are available:

• Normal mode in which only the numbers are displayed.

• Bar mode in which each number is overlaid by a bar of length corresponding to the number (see Figure 16).

• Pure bars mode in which only the bars are shown (see Figure 17).

• Auto normalize can be turned on, meaning that when dragging a bar the other bars belonging to the distribution are automatically adjusted to make sure the numbers (represented by the bar lengths) sum to 1.

• Locate Node selects and scrolls to the node whose table is viewed.

• Show / hide experience table toggles between showing or hiding the experience table, if any.

• Show / hide fading table toggles between showing or hiding the fading table, if any.

• Show state labels shows state labels for numbered or interval nodes (instead of state values). This allows for emulation of “ordinal” nodes. That is, a node can have the state labels “low”, “medium”, and “high”, and these will have a natural ordering which can be used in expressions.

• Table Precision displays a dialog for setting the number of decimals shown in the table.

• Toggle table mode toggles between framed and tabbed tables.

• Node Properties shows the properties for the node whose table is viewed.

See the next section for more details on display modes.

## Displaying a Node Table¶

When the Tables Pane is open, the tables for the nodes selected in the Network Pane will be displayed. The HUGIN Graphical User Interface has a number of powerful features for displaying node tables:

• Resizing through dragging

• Re-ordering of parents

• Collapsing the display of subsets of parent configurations

• Displaying probabilities as numbers, bars, or both.

A node table frame (i.e., the internal window displaying the table) can be resized arbitrarily by clicking and holding (i.e., dragging) the left mouse at the border of the frame. The width of the cells of the table resizes correspondingly. The width of the first column (containing parent and state names) can be resized by dragging the left mouse button at the border between the first and the second column. This can be useful if the parent and/or state names are very long or very short.

The order of appearance of the parents in the node table can be changed in Table tab of the Node Properties pane. This can be useful for grouping together sets of distributions.

Also, for better viewing of selected sets of distributions, sets of columns (corresponding to sets of parent configurations) can be collapsed by double-clicking the appropriate labels for parent states. Figure 12 shows (part of) the table for node C5 with parents C1, C2, C3, and C4. Now, suppose we’re interested in working with the probability distributions for C1 in state “State 2”. One option would be to use the horizontal scroll bar. Another, much easier and more convenient approach would be to collapse the part of the table where C1 is in state “State 1”. This can be achieved by double-clicking the text field labeled “State 1” in the C1 row.

Figure 13 shows the resulting table. Note that the width of the cells has changed, allowing us to see all digits after the decimal point. Likewise, we can collapse other columns. In general, the cells in the parent states section can be double-clicked for all parent rows but the last, making the corresponding columns collapse. Figure 14 shows the table with all columns collapsed where the states for all parent nodes but C4 equals “State 1”.

A collapsed column can be expanded by double-clicking the top cell of the column. Please note that when changing the order of appearance of the parents (see above), any collapsed columns will be expanded. Sometimes, viewing or even specifying probability distributions graphically instead of numerically is preferable. The HUGIN Graphical User Interface allows the user to select among three different display modes: The numerical mode (denoted the Normal mode), the numerical and graphics mode (denoted the Bar mode), and the graphics mode (denoted the Pure bars mode). The desired mode can be selected under the View menu, see Figure 15.

Figures 16 and 17 show the table of Figure 14 in Bar mode and Pure bars mode, respectively.

Graphical specification of probabilities is performed by dragging the bars with the left mouse button. When Bar mode or Pure bars mode have been selected, the distributions can be set to auto-normalize when the probabilities are changed. This feature can be selected under the Display mode submenu of the View menu.

Please note that the graphical viewing and specification mode is available only in tables for discrete chance and decision nodes.