comparison toolboxes/FullBNT-1.0.7/bnt/inference/online/@jtree_2TBN_inf_engine/marginal_nodes.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 marginal = marginal_nodes(engine, b, nodes, t, add_ev, is_fam)
2 % function marginal = marginal_nodes(engine, b, nodes, t, add_ev, is_fam) (jtree_2TBN)
3
4 if nargin < 6, is_fam = 0; end
5 ss = engine.slice_size;
6
7 if ~is_fam & (t > 1) & all(nodes<=ss)
8 nodes = nodes + ss;
9 end
10
11 if t==1
12 c = clq_containing_nodes(engine.jtree_engine1, nodes, is_fam);
13 else
14 c = clq_containing_nodes(engine.jtree_engine, nodes, is_fam);
15 end
16 if c == -1
17 error(['no clique contains ' nodes])
18 end
19 bigpot = b.clpot{c};
20 pot = marginalize_pot(bigpot, nodes, engine.maximize);
21 marginal = pot_to_marginal(pot);
22
23 % we convert the domain to the unrolled numbering system
24 % so that add_ev_to_dmarginal (maybe called in update_ess) extracts the right evidence.
25 if t > 1
26 marginal.domain = nodes+(t-2)*engine.slice_size;
27 end
28 assert(~add_ev);
29
30
31
32