Home > Mateda2.0 > sampling > FindMPE.m

# FindMPE

## PURPOSE

[mpe_solution,prob_value] = FindMPE(bnet):

## SYNOPSIS

function[mpe_solution,prob_value] = FindMPE(bnet)

## DESCRIPTION

     [mpe_solution,prob_value] =  FindMPE(bnet):
                               Computes the most probable explanation given the Bayesian network
     INPUTS
     bnet:                Bayesian network
     OUTPUTS
     mpe_solution: Most probable explanation
     prob_value:  Its corresponding probability value

     Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- Most_probable_explanations function[MPEs] = Most_probable_explanations(bnets,func)
- SampleMPE_BN [NewPop] = SampleMPE_BN(NumbVar,bnet,Card,sampling_params):

## SOURCE CODE

    0001  function[mpe_solution,prob_value] =  FindMPE(bnet)
    0002 % [mpe_solution,prob_value] =  FindMPE(bnet):
    0003 %                           Computes the most probable explanation given the Bayesian network
    0004 % INPUTS
    0005 % bnet:                Bayesian network
    0006 % OUTPUTS
    0007 % mpe_solution: Most probable explanation
    0008 % prob_value:  Its corresponding probability value
    0009 %
    0010 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
    0011
    0012  n = size(bnet.dag,1); % number of nodes
    0013
    0014  engine = jtree_inf_engine(bnet, 'maximize', 1);
    0015  for i=1:n,
    0016   auxvar{i} = [];           %      All variables are hidden
    0017  end,
    0018  mpe_solution = find_mpe(engine,auxvar);
    0019  [eng, logprob] = enter_evidence(engine, mpe_solution);
    0020  prob_value = exp(logprob);
    0021