const prob_bn* GetNodeProbs_bn ( const node_bn*  node,   const state_bn*  parent_states )

Returns the conditional probabilities of node, given that its parents are in the states indicated by the parent_states vector, by looking them up in the node's CPT table. The length of parent_states must be the number of parents of node, and each of its entries provides a state for the corresponding parent. The length of the array returned is the number of states of node, and consists of 'prob_bn's (i.e. 'float's), which are the conditional probabilities:

P (node = state0 | parents take on parent_states)

P (node = state1 | parents take on parent_states)

...

P (node = stateN | parents take on parent_states)

Notice that it is not conditioned on any findings (evidence) entered into the net, so its value will not change as findings are added or belief updating is done.

NULL will be returned if no CPT table has been associated with node (for example by SetNodeProbs_bn, SetNodeFuncState_bn, EquationToTable_bn, ReviseCPTsByCaseFile_bn or ReviseCPTsByFindings_bn), or if the table has been removed (for example by DeleteNodeTables_bn), but no error will be generated. If you use only SetNodeEquation_bn to indicate a node's relation with its parents, you must also call EquationToTable_bn before this will return non-NULL.

The order of the states in parent_states should match the order of the nodes in the list returned by GetNodeParents_bn (this will be the same order that parents were added using AddLink_bn). MapStateList_bn may be useful for that. parent_states can be NULL if node has no parents.

parent_states should not include EVERY_STATE or UNDEF_STATE.

If SetNodeFuncState_bn was used to provide node with a function table, then GetNodeProbs_bn can be used to retrieve that table in the form of conditional probabilities, which will all be 0 or 1.

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.

To get all the conditional probabilities of node at once, see the GetNodeAllProbs example below.

To cycle through all the possibilities of parent_states, see the NeticaEx function NextStates.

If parent_states is NULL then the entire table is returned.

Version:

This function is available in all versions.