double JointProbability_bn ( const nodelist_bn*  nodes,   const state_bn*  states )

Returns the joint probability that each node in nodes is in the corresponding state of states, given the findings currently entered in the Bayes net. The states array must provide a state for each node of nodes.

This function is designed to work fast when retrieving many joint probabilities from nodes that were put in the same clique (see below) during net compilation. The first time it is called it will take longer to return, but on subsequent calls it will return very fast if these conditions are met:

  1. nodes is the same list for each call.
  2. No calls to it with a different nodes list were made in between.
  3. No new findings have been entered or retracted.
  4. No change was made to the net requiring re-compilation.
  5. Each of nodes was placed in the same clique during compiling.

If conditions 1 or 2 are violated, it will still be much faster than doing a new belief updating, but not as fast as if they aren't violated. If the other conditions are violated, then it will take the same time as 1 or 2 belief updatings.

All of nodes must come from the same Bayes net.

None of nodes should have a likelihood finding (but they may have other types of findings, and other nodes in the net may have likelihood findings).

You can be sure a set of nodes will be placed in the same clique if there is some "family" in the Bayes net which contains all of them.

A family consists of a node and its parents. The function FormCliqueWith (in the example below and in NeticaEx.c) can be used to ensure that all of nodes will be put in the same clique during the next compile.


Versions 1.18 and later have this function.
In versions previous to 2.10 this function was named GetJointProb_bn.

See also:

FindingsProbability_bn    Joint probability for current findings
GetNodeBeliefs_bn    Posterior probability for a single node
GetNodeProbs_bn    Gets CPT entries of a node


The following function is available in NeticaEx.c:
// Ensures that at the next compile all of nodes will be put in the same clique. // It is useful for the JointProbability_bn function. // It works by adding a dummy node with 1 state, and returning that node (or NULL if it // wasn't necessary to add one). // Its effects can be completely undone by calling DeleteNode_bn on the node it returns. // node_bn* FormCliqueWith (const nodelist_bn* nodes){ net_bn* net; node_bn* new_node; int i, num_nodes = LengthNodeList_bn (nodes); if (num_nodes <= 1) return NULL; net = GetNodeNet_bn (NthNode_bn (nodes, 0)); new_node = NewNode_bn (NULL, 1, net); for (i = 0; i < num_nodes; ++i) AddLink_bn (NthNode_bn (nodes, i), new_node); return new_node; }