Creating DBN

<< Click to Display Table of Contents >>

Navigation:  Using GeNIe > Dynamic Bayesian networks >

Creating DBN

Consider the following example, inspired by (Russell & Norvig, 1995), in which a security guard at some secret underground installation works on a shift of seven days and wants to know whether it is raining on the day of her return to the outside world. Her only access to the outside world occurs each morning when she sees the director coming in, with or without, an umbrella. Furthermore, she knows that the government has two secret underground installations: one in Pittsburgh and one in the Sahara, but she does not know which one she is guarding. For each day t, the set of evidence contains a single variable Umbrellat (observation of an umbrella carried by the director) and the set of unobservable variables contains Raint (a propositional variable with two states true and false, denoting whether it is raining) and Area (with two possible states: Pittsburgh and Sahara). The prior probability of rain depends on the geographical location and on whether it rained on the previous day.

We will use GeNIe to model this example. We start with enabling the Temporal Plate, which is a special construct in the Graph View that allows for building dynamic models

network_menu_dynamic_models

The effect of enabling temporal plate in the Graph View is the following

temporal_plate

The Temporal Plate divides the Graph View into four areas:

Contemporals, which is the part of the Network View window that is outside of the temporal plate. All nodes in that are are static.

Init Conditions, which is the part of the network area where, so called, anchor nodes are stored. An anchor node is a node outside of the temporal plate that has one or more children inside the temporal plate. Anchor nodes are similar to static nodes outside of the temporal plate but they are only connected to tehir children in the first time-slice of the network.

Temporal Plate, which is the main part representing the dynamic model. Nodes in the Temporal Plate are the only nodes that are allowed to have Temporal Arcs. This area also shows the number of time-slices for which inference will be performed.

Term Conditions, which is the part of the network area where the terminal nodes are stored. A terminal node is a node outside of the temporal plate that has one or more parents inside the temporal plate. Terminal nodes are only connected to its parents in the last time-slice of the network.

The size of the Temporal Plate can be changed by clicking and dragging its edges and so can the sizes of its three areas (Init Conditions, Temporal Plate, and Term Conditions). There is a small subtlety in resizing the three. If you click and drag the extreme right or extreme left edge of the temporal plate, it is the middle part (the Temporal Plate) that gets resized and the sizes of Init Conditions and Temporal Plate remain the same. Pressing the SHIFT button when dragging the edges has the effect that the size of the Temporal Plate remains the same and the sizes of Init Conditions and Temporal Plate change.

For our example, we set the number of steps to 8. We can either double-click or right-click on the header of the Temporal Plate

temporal_plate_header_menu

which will invoke the Time Step Count dialog that allows to change the Time step count

time_step_count_dialog

We create the following nodes: Location in the Contemporals, Rain and Umbrella in the Temporal Plate and set their states as described in the example above.

temporal_plate_nodes

The next step is to connect these nodes. We draw an arc from Location to Rain and then from Rain to Umbrella. The first arc is a regular Bayesian network arc but in case of the second arc, we are connecting nodes inside the Temporal Plate and need to indicate the time order of the arc drawn

temporal_plate_arc1

Because the influence of Rain on whether or not the director carries an umbrella with her is instantaneous, we choose Normal arc. We draw an arc from the node Rain to itself, which will represent the impact on Rain on a given day that Rain on the prior day has. To achieve this, select the Arc tool, click and hold on the Rain node, move the cursor outside of the node and back into it, upon which the node becomes black, and release the cursor, which will cause the arc order menu to pop up. In this case, we choose Order 1, which indicates that the impact has a delay of 1 day: The state of the variable Rain on the previous day impacts the state of Rain today.

temporal_plate_arc2

This operation will result in a temporal arc of order 1 being created from the node Rain to itself. Please note that the restriction that the graph of a Bayesian network be acyclic does not hold inside the Temporal Plate. Cycles represent temporal processes and are allowed only for temporal arcs. Similarly to static networks, normal arcs are not allowed to form cycles, even inside temporal plates.

Please note that a DBN, as implemented in GeNIe, can have temporal arcs of any order, which means that DBNs in GeNIe can model dynamic processes of any order.

We define each of the nodes in terms if their states and numerical probabilities. Definitions of the nodes Location and Umbrella are identical to the definitions of nodes in Bayesian networks:

temporal_plate_node_location_definition        temporal_plate_node_umbrella_definition

However, the definition of the node Rain is specific to DBNs, as one of the incoming arcs is temporal

temporal_plate_node_rain_definition

Please note an additional pop-up menu on the right-hand side, marked t=0. This menu allows us to traverse through the conditional probability tables that compose the definition of node Rain. For t=0, we enter the prior probability of rain on day 0:

temporal_plate_node_rain_definition0

For t=1, which denotes any day that has an observation of rain on the prior day, we enter the prior probability of rain on day 1 as a function of the Location and rain on the previous day:

temporal_plate_node_rain_definition1

This concludes the creation and specification of the DBN modeling the problem. There is another way of creating a DBN. Rather than constructing it directly in the Temporal Plate, we can construct a BN in the Graph View window, drag it into the Temporal Plate, and adding temporal links. This has to be done cautiously, as the order of dragging can make a difference. For example, if we drag the node Rain into the Temporal Plate, GeNIe will remove the arc between the nodes Rain and Umbrella. This is because it is not allowed to have arcs from temporal plate enter nodes in the Contemporals plate. To avoid that, we can drag both the Umbrella and Rain nodes into the temporal plate, in which case no links will be deleted.