Hybrid models

<< Click to Display Table of Contents >>

Navigation:  Using SMILE >

Hybrid models

Hybrid models are networks with both discrete and continuous nodes. Arcs in a hybrid network can link all combinations of node types, so it is possible to add an arc from a continuous to a discrete node, and from a discrete to a continuous node. Inference in hybrid models follows the rules defined for continuous nodes (sampling when there is no evidence in nodes with parents, discretization otherwise). Basically, hybrid models can be treated as continuous models with discrete nodes representing a specialized function, namely a conditional probability table specified by an array of numbers.

Adding arcs from a discrete to a continuous node is performed by including the discrete node identifier in the continuous node's equation (as is the case for the continuous to continuous arcs). The following discussion assumes that the reader is familiar with functions from which node equations are built (functions implemented in SMILE are described in detail in the Equations section of the reference part of this manual).

For example, assuming that a node c is continuous and its only parent d is a discrete node with three outcomes High, Medium and Low, the equation for c may look as follows: c=Normal(If(d="Medium"), 1, -1), 5). When in the process of sampling, we calculate the value of node c, we need the value of d. The equation says that c should be drawn from a normal distribution with standard deviation equal to 5, but with mean depending on value of d. If d is in state Medium, the mean will be 1 and -1 otherwise.

Reference to a discrete node can appear anywhere in an equation, for example, c=log(1+d) or c=2^d, where d is discrete. The value of d amounts simply to its state number. The equation in the example above could be thus rewritten as c=Normal(If(d=1, 1, -1), 5). Index 1 refers to the (zero-based) second state of d, which is Medium. The original form, using a text literal, may be more readable.

Caution: SMILE will not modify the text literals representing the outcomes of discrete parent nodes if the outcome identifiers change. If the text literal cannot be associated with any parent node outcome, its value is evaluated as -1 (minus one).

In addition to the function If() or its equivalent, the ternary operator ?:, the common functions to use with discrete nodes are Switch and Choose. For example, the equation for node c with three possible means of its normal distributions can look like this: c=Normal(Switch(d, "High", 3.2, "Medium", 2.5, "Low", 1.4), 5). An alternative notation would be c=Normal(Choose(d, 3.2, 2.5, 1.4), 5).

To add an arc from a continuous to a discrete node, use DSL_network::AddArc (the method used in discrete models). In such case, the discretization intervals of the parent node are considered to be the equivalent of the outcomes of discrete parent.

Tutorial 8 contains a complete program demonstrating the use of hybrid models.