comparison toolboxes/FullBNT-1.0.7/bnt/general/compute_joint_pot.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function [jpot, loglik] = compute_joint_pot(bnet, nodes, evidence, domain)
2 % COMPUTE_JOINT_POT Compute the global joint potential of a Bayes net
3 % function jpot = compute_joint_pot(bnet, nodes, evidence, domain)
4
5 if nargin < 4, domain = nodes; end
6
7 onodes = find(~isemptycell(evidence));
8 pot_type = determine_pot_type(bnet, onodes, domain);
9
10 jpot = mk_initial_pot(pot_type, domain, bnet.node_sizes, bnet.cnodes, onodes);
11 for i=nodes(:)'
12 e = bnet.equiv_class(i);
13 fam = family(bnet.dag, i);
14 pot = convert_to_pot(bnet.CPD{e}, pot_type, fam(:), evidence);
15 jpot = multiply_by_pot(jpot, pot);
16 end
17 %[jpot, loglik] = normalize_pot(jpot); % causes errors in asia_dt1 etc