function[MPEs] = Most_probable_explanations(bnets,func) Most_probable_explanations: Computes the most probable explanation and its fitness value at each generation given the corresponding Bayesian network INPUT bnets{maxgen}: Cell array that stores the Bayesian networks learned at each generation func: The fitness function used in the EDA execution OUTPUT MPEs: Cell array that stores the most probable configuration, its probability values and its fitness function at each generation. MPEs{1,i}: An array with the point with highest probability at generation i MPEs{2,i}: The probability value for the MPE at generation i. It is an array where MPEs{2,i}(1,1) is the probability in logarithmic scale and MPEs{2,i}(1,2) is the original probability value. MPEs{3,i}: The fitness function value for the MPE at generation i Example: for i=1:maxgen bnets{i}=Cache{3,i}; end [MPEs] = Most_probable_explanations(bnets, F); The fitness function corresponding to the most probable configurations are shown for i=1:maxgen fo_mpes(i)=MPEs{3,i}; end X=[1:maxgen]; plot(X,fo_mpes); Last version 5/11/08. Carlos Echegoyen and Roberto Santana(carlos.echegoyen@ehu.es)
0001 function[MPEs] = Most_probable_explanations(bnets,func) 0002 % function[MPEs] = Most_probable_explanations(bnets,func) 0003 % 0004 % Most_probable_explanations: Computes the most probable explanation and its fitness value at each 0005 % generation given the corresponding Bayesian network 0006 % 0007 % INPUT 0008 % bnets{maxgen}: Cell array that stores the Bayesian networks learned at 0009 % each generation 0010 % func: The fitness function used in the EDA execution 0011 % 0012 % 0013 % OUTPUT 0014 % MPEs: Cell array that stores the most probable configuration, its 0015 % probability values and its fitness function at each 0016 % generation. 0017 % 0018 % MPEs{1,i}: An array with the point with highest probability at generation i 0019 % MPEs{2,i}: The probability value for the MPE at generation i. It 0020 % is an array where MPEs{2,i}(1,1) is the probability 0021 % in logarithmic scale and MPEs{2,i}(1,2) 0022 % is the original probability value. 0023 % MPEs{3,i}: The fitness function value for the MPE at generation i 0024 % 0025 % Example: 0026 % for i=1:maxgen 0027 % bnets{i}=Cache{3,i}; 0028 % end 0029 % [MPEs] = Most_probable_explanations(bnets, F); 0030 % 0031 % The fitness function corresponding to the most probable configurations are shown 0032 % for i=1:maxgen 0033 % fo_mpes(i)=MPEs{3,i}; 0034 % end 0035 % X=[1:maxgen]; 0036 % plot(X,fo_mpes); 0037 % 0038 % Last version 5/11/08. Carlos Echegoyen and Roberto Santana(carlos.echegoyen@ehu.es) 0039 0040 k = size(bnets,2); % Number of net 0041 num_vars = size(bnets{1}.dnodes,2); % Number of variables 0042 0043 for i=1:k 0044 [mpe_solution,prob_value] = FindMPE(bnets{i}); 0045 MPEs{1,i} = cell2num(mpe_solution)-1; 0046 MPEs{2,i} = prob_value; 0047 MPEs{3,i} = feval(func,MPEs{1,i}); 0048 end 0049