Discrete deterministic nodes

<< Click to Display Table of Contents >>

Navigation:  Using SMILE > Discrete Bayesian networks >

Discrete deterministic nodes

Discrete deterministic nodes can be created by using the DSL_TRUTHTABLE node type identifier when calling DSL_network::AddNode. They behave like CPT nodes, with the exception that their probability tables contain only zeros and ones. Deterministic nodes are defined as having no noise in their definition, so there is no uncertainty about the outcome of a deterministic node once all its parents are known. Please note that deterministic nodes are not free of the problem of exponential probability table growth described in the CPT nodes section.

While it is possible to model a deterministic variable using a chance node with its CPT filled with zeros and ones, the deterministic nodes are displayed as double ellipses in GeNIe, making the modeler's intent explicit and, hence, reduces the probability of modeling errors.

The definition of a deterministic node is represented by the object of the DSL_truthTable class. The code snippet below assumes a deterministic node with three outcomes and two binary parents. Its definition is set with a call to DSL_truthTable::SetResultingStates. For each column of the truth table, we specify one resulting state:

DSL_node *node = net.GetNode(detHandle);

auto tt = node->Def<DSL_truthTable>();

DSL_intArray resStates = { 2, 0, 1, 1 };

tt->SetResultingStates(resStates);

The following one-liner peforms the same task: .

net.GetNode(detHandle)->Def<DSL_truthTable>()->SetResultingStates({2,0,1,1});

The truth table created by the above code would look as follows in GeNIe:

truthtable

There is also SetResultingStates method which takes an array of strings as input. An equivalent to the example above would initialize the DSL_stringArray with {"State2", "State0", "State1", "State1"}. See the DSL_truthTable reference for details.