NORSYS SOFTWARE © 2012 | NETICA API | C   VERSION   5.04  |
const prob_bn* GetNodeBeliefs_bn ( | node_bn* node ) |
Returns a belief vector indicating the current probability for each state of node (each entry is a prob_bn, which is a 'float').
The vector will be indexed by states, with one probability for each state (if required, the state indexes can be found from their names using GetStateNamed_bn). It will be normalized, so that the sum of its entries is 1.
This provides the current beliefs (i.e., posterior probabilities) that the variable represented by node is in each of its states, given the net model and all findings entered into all nodes of the net (positive findings, negative findings and likelihood findings).
The net containing node must have been compiled before calling this (with CompileNet_bn), or an error will be generated. If the net has been modified it must be recompiled, but just entering findings does not require a recompile.
node should be a discrete or discretized nature node.
If belief updating hasn't been done since the last findings were entered, it will be done before this function returns, which can be time consuming (you can call IsBeliefUpdated_bn before calling this to find out if belief updating will be done).
If you need the beliefs to persist, make a copy of the vector returned, since its contents may become invalid after further calls to Netica API. Do not try to directly modify or free the vector returned.
Version:
See also:
IsBeliefUpdated_bn | Tells whether GetNodeBeliefs_bn will trigger belief updating | |
GetNodeNumberStates_bn | Determine length of vector returned | |
JointProbability_bn | More than one node at a time | |
CompileNet_bn | To do the initial compiling before entering findings | |
GetNodeExpectedUtils_bn | Get the resulting expected utility of a decision node | |
GetNodeExpectedValue_bn | For numeric nodes, get expected value and standard deviation |
Example:
// This function is useful to get the belief that a certain node is in // a certain state, based on the names of the node and state.The following function is available in NeticaEx.c:// double GetNodeBelief (char* node_name, char* state_name, net_bn* net){ node_bn* node = GetNodeNamed_bn (node_name, net); state_bn state = GetStateNamed_bn (state_name, node); return GetNodeBeliefs_bn (node) [state]; }