Hybrid models

<< Click to Display Table of Contents >>

Navigation:  Using SMILE Wrappers >

Hybrid models

Hybrid models are networks with both discrete and continuous nodes. The 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. Iinference 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 the specialized function, namely conditional probability table specified by an array of numbers.

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

For example, assuming that a node c is continuous and a node d is discrete, the equation for c may look like this: c=Normal(If(d=1, 1, -1), 5). When a sample for node c is evaluated, one of its inputs will be the value of its parent node d. Discrete node values are numbers drawn from the interval [0 .. N-1], where N is the number of discrete node outcomes. Therefore, the example equation for c above says that c should be drawn from a normal distribution with standard deviation equal to 5, but with mean depending on the parent node d. If d is in its (zero-based) state with index 1, the mean will be 1 and -1 otherwise.

To improve the readability of the equation, the outcomes of the parent discrete nodes can also be represented as text literals. If d has three outcomes High, Medium and Low, then the equation from the preceding example could be rewritten as c=Normal(If(d="Medium"), 1, -1), 5).

In addition to the function If or its counterpart, 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).

Important: 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, it's value is evaluated as -1 (minus one).

Generally speaking, discrete nodes can appear anywhere in the equation where numbers can be used: c=log(1+d) or c=2^d. This kind of equation does not use the text literals representing the discrete node outcomes (because there is no comparison involved in evaluation the equation).

To add an arc from a continuous to a discrete node, use 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.