[Prob] = BN_Pop_Prob(bnet,Pop): BN_Pop_Prob: Computes the probabilities given to the solutions in Pop by the networks INPUTS bnet: Bayesian network Pop: Population OUTPUTS Prob: Vector with the probabilities given by Bayesian network to each of the solutions Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
0001 function[Prob] = BN_Pop_Prob(bnet,Pop) 0002 % [Prob] = BN_Pop_Prob(bnet,Pop): 0003 % BN_Pop_Prob: Computes the probabilities given to the solutions in Pop by the 0004 % networks 0005 % INPUTS 0006 % bnet: Bayesian network 0007 % Pop: Population 0008 % OUTPUTS 0009 % Prob: Vector with the probabilities given by Bayesian network to each of 0010 % the solutions 0011 % 0012 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es) 0013 0014 PopSize = size(Pop,1); 0015 0016 engine = jtree_inf_engine(bnet, 'maximize', 1); 0017 0018 for i=1:PopSize, 0019 vect = num2cell(Pop(i,:)+1); 0020 [eng, logprob] = enter_evidence(engine,vect); 0021 Prob(i,1) = exp(logprob); 0022 end