Outcome point values

<< Click to Display Table of Contents >>

Navigation:  Using SMILE > Discrete Bayesian networks > Discrete nodes and numeric domains >

Outcome point values

To define a discrete distribution over numeric node outcomes, use DSL_discDef::SetPointValues. The example below assumes that node has three outcomes:

int handle = …

auto discDef = net.GetNode(handle)->Def<DSL_discDef>();

discDef->SetPointValues({ 3.14, -2.78, 77 });

The three numeric values in std::initializer_list (overloads with DSL_doubleArray and std::vector are also available) will be associated with existing node outcomes. In contrast with SetIntervals, SetPointValues requires its first parameter to have the number of elements equal to the number of node outcomes (it will not add or remove outcomes). There is also no requirement for ordering point values. The identifiers of the outcomes will not be modified, as nodes with point values always require outcome identifiers.

Outcome modifying methods like AddOutcome, InsertOutcome or DeleteOutcome work normally when node has point values. New outcomes will have their point values initialized to zero. The point values can only be changed all at once with another SetPointValues call.

Other methods in the DSL_discDef for working with point values are HasPointValues, GetPointValues and RemovePointValues.

With point values defined, it is straightforward to calculate the mean and standard deviation for the marginal probability distribution over the outcomes of the node. To retrieve the mean or the standard deviation, call GetMean or GetStdDev respectively on the node value object.

Point values do not allow for continuous evidence in the discrete nodes. Calling SetEvidence(double) will fail, even if the parameter is equal to one of the defined point values.