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