void MostProbableConfig_bn ( const nodelist_bn*  nodes,   state_bn*  config,   int  nth )

Finds the most probable configuration, also known as the most probable explanation (MPE), for all the nodes in the net. This is the setting for each of the nodes with the highest overall joint probability, given the currently entered findings. Of course it is consistent with the findings.

For nodes, you must pass a list returned by GetNetNodes_bn.

Pass 0 for nth. It is only for future expansion.

For config, pass an array of state_bn at least as long as nodes. The initial contents of this array will be ignored.

Netica will fill the config array with the configuration of highest joint probability given the currently entered findings. Each element of config is the state for the corresponding node of nodes (i.e., they are in the same order, and have the same length).

The net must be compiled before calling this function.

After finding the most probable configuration, you can use JointProbability_bn to find its probability (see example below).

You can mix calls to this function with calls to GetNodeBeliefs_bn (which finds posterior probabilities).

This function does not work when likelihood findings are entered. In that case you must make child nodes corresponding to the observations, whose CPTs are the likelihoods, and enter a positive finding for them.

If you must have the MPE of a smaller set of nodes than all the nodes in the net, you can use AbsorbNodes_bn to remove the other nodes first.

Keep in mind that in the MPE, some nodes may be assigned states that are quite unlikely (i.e., the state won't be the one with the highest probability as returned by GetNodeBeliefs_bn). That may be necessary in order to achieve the highest overall joint probability, considering the assignment of states to the other nodes. Before using this function, consider carefully whether you really want the MPE, or rather just a list of the most probable state for each of the nodes.

The algorithm Netica uses to find the MPE is known as a "max propagation" in the junction tree.

Version:

Versions 1.07 and later have this function.

See also:

JointProbability_bn    Find the actual joint probability of a configuration
GetNodeBeliefs_bn    Can find the most probable state for a single node only
GetNetNodes_bn    Get the list of nodes

Example:

// The following puts the most probable configuration in config,
// and its probability in maxprob.
//
CompileNet_bn (net);
const nodelist_bn* allnodes = GetNetNodes_bn (net);
int num_nodes = LengthNodeList_bn (allnodes);
state_bn* config = new state_bn [num_nodes];
MostProbableConfig_bn (allnodes, config, 0);
double maxprob = JointProbability_bn (allnodes, config);
// ... use config and maxprob ...
delete config;