CPT nodes

<< Click to Display Table of Contents >>

Navigation:  Using SMILE > Discrete Bayesian networks >

CPT nodes

CPT nodes are general chance variables, represented by conditional probability tables. To create a CPT node in SMILE, pass DSL_CPT as node type to DSL_network::AddNode.

The new node will have an instance of DSL_cpt class as its definition. In practice, there is no need to cast the DSL_nodeDef pointer returned by DSL_node::Def to DSL_cpt, because all required functionality (outcome management and access to the conditional probability table) is accessible through the virtual methods introduced in the base class DSL_nodeDef. The node value object will be an instance of DSL_beliefVector class. As with the definition, there is no need for explicit casting the DSL_nodeVal returned from DSL_node::Val. Access to evidence and calculated posterior probabilities can be performed through virtual methods defined in the base class DSL_nodeVal.

The Hello, SMILE! program and tutorials 1, 2, and 3 are using CPT nodes through base classes DSL_nodeDef and DSL_nodeVal.

Please note that as you increase the number of parents of a node, the node's CPT grows exponentially. With 10 binary parents, the CPT contains 1,024 columns, with 20 binary parents, this number is 1,048,576. As the number of parents grows, at some point, this will exhaust all available computer memory. The canonical nodes described in the next section offer a solution to the exponential CPT growth.