const prob_bn* GetNodeLikelihood_bn ( const node_bn*  node )

Returns a likelihood vector with one entry for each state of node, indicating the findings that have been entered for node since the last retraction, including positive findings, negative findings, and likelihood findings.

If a positive finding has been entered, then the likelihood vector will consist of all zero entries, except a nonzero entry for the state corresponding to the finding (for more details on likelihood vectors, see EnterNodeLikelihood_bn).

If a number of likelihood findings and/or negative findings have been entered for this node, they will be accumulated in the vector returned.

If no findings have been entered for this node since the last retraction, a uniform vector consisting of all 1's is returned. This is consistent with the concept of likelihood, since a likelihood finding which is a uniform vector is equivalent to no finding at all, and will not modify any beliefs.

This function cannot be used on a continuous node, unless the node has first been discretized (see SetNodeLevels_bn).

If you need the results 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:

This function is available in all versions.

See also:

GetNodeFinding_bn    Returns a scalar saying whether findings have been entered, and what kind
GetNodeBeliefs_bn    Current belief for a node (considers findings entered at other nodes)
EnterNodeLikelihood_bn    To enter a vector of uncertain findings (see example below)
RetractNodeFindings_bn    To clear away all findings entered so far for this node
GetNodeNumberStates_bn    Determine the length of the vector returned

Example:

// To temporarily remove all findings from a node and later restore them
//
int size = GetNodeNumberStates_bn (node) * sizeof (prob_bn);
char* save = malloc (size);
memcpy (save, GetNodeLikelihood_bn (node), size);
RetractNodeFindings_bn (node);
... [stuff without the evidence] ...
RetractNodeFindings_bn (node);			// in case any findings were introduced above
EnterNodeLikelihood_bn (node, save);		// restores to original
free (save);