Home > Mateda2.0 > knowledge_extraction > Probability_monitor.m

Probability_monitor

PURPOSE ^

function [Probs] = Probability_monitor(bnets, point)

SYNOPSIS ^

function [Probs] = Probability_monitor(bnets, point)

DESCRIPTION ^

 function [Probs] =  Probability_monitor(bnets, point)

 Probability_monitor: Computes the probability given by the models to a given point along the generations.
                      For example, it is useful to calculate the probability of the
                      optimum point during the search if it is known. 
                      Nevertheless, it is also useful to calculate the probability of different interesting points such as 
                      suboptimals. 
 INPUT
 bnets{maxgen}: Cell array that stores the Bayesian networks learned at
                each generation. It is obtained from Cache{3,:}
 point: Array with the point whose probability will  be computed. For example the
        optimum point


 OUTPUT
 Probs: An array with the probability for the given point at each
        generation. The values are in logarithmic scale. 

 Example: (If the algorithm have reached the optimum (it is known))
 optimal_point = AllStat{maxgen,2}
 for i=1:maxgen
   bnets{i}=Cache{3,i};
 end
 [P] = Probability_monitor(bnets, optimal_point);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Probs] =  Probability_monitor(bnets, point)
0002 
0003 % function [Probs] =  Probability_monitor(bnets, point)
0004 %
0005 % Probability_monitor: Computes the probability given by the models to a given point along the generations.
0006 %                      For example, it is useful to calculate the probability of the
0007 %                      optimum point during the search if it is known.
0008 %                      Nevertheless, it is also useful to calculate the probability of different interesting points such as
0009 %                      suboptimals.
0010 % INPUT
0011 % bnets{maxgen}: Cell array that stores the Bayesian networks learned at
0012 %                each generation. It is obtained from Cache{3,:}
0013 % point: Array with the point whose probability will  be computed. For example the
0014 %        optimum point
0015 %
0016 %
0017 % OUTPUT
0018 % Probs: An array with the probability for the given point at each
0019 %        generation. The values are in logarithmic scale.
0020 %
0021 % Example: (If the algorithm have reached the optimum (it is known))
0022 % optimal_point = AllStat{maxgen,2}
0023 % for i=1:maxgen
0024 %   bnets{i}=Cache{3,i};
0025 % end
0026 % [P] = Probability_monitor(bnets, optimal_point);
0027 
0028 % Last version 5/11/2008. Carlos Echegoyen and Roberto Santana (carlos.echegoyen@ehu.es)
0029 
0030 k = size(bnets,2);                   % Number of networks
0031 num_vars = size(bnets{1}.dnodes,2);  % Number of variables
0032 
0033 for j=1:num_vars
0034     point_cell{j} = point(j)+1;
0035 end
0036 
0037 for i=1:k
0038     engine = jtree_inf_engine(bnets{i});
0039     [eng, loglik_point]=enter_evidence(engine,point_cell);
0040     Probs(i) = exp(loglik_point);
0041 end

Generated on Fri 04-Dec-2009 13:38:29 by m2html © 2003