Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/bnt/inference/static/@jtree_inf_engine/Old/distribute_evidence.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 engine = distribute_evidence(engine, root) | |
2 | |
3 if isempty(engine.preorder{root}) | |
4 % this is the first time we have distributed from this root | |
5 % memoize the order | |
6 [jtree, preorder, postorder] = mk_rooted_tree(engine.jtree, root); | |
7 preorder_children = cell(1,length(preorder)); | |
8 for n=preorder | |
9 preorder_children{n} = children(jtree, n); | |
10 end | |
11 engine.preorder{root} = preorder; | |
12 engine.preorder_children{root} = preorder_children; | |
13 else | |
14 preorder = engine.preorder{root}; | |
15 preorder_children = engine.preorder_children{root}; | |
16 end | |
17 | |
18 | |
19 % distribute from root (node to children) | |
20 for n=preorder(:)' | |
21 for c=preorder_children{n}(:)' | |
22 engine.clpot{c} = divide_by_pot(engine.clpot{c}, engine.seppot{n,c}); | |
23 engine.seppot{n,c} = marginalize_pot(engine.clpot{n}, engine.separator{n,c}, engine.maximize); | |
24 engine.clpot{c} = multiply_by_pot(engine.clpot{c}, engine.seppot{n,c}); | |
25 end | |
26 end |