To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Revision:

root / _FullBNT / BNT / general / compute_joint_pot.m @ 8:b5b38998ef3b

History | View | Annotate | Download (720 Bytes)

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