Mercurial > hg > camir-aes2014
annotate toolboxes/FullBNT-1.0.7/bnt/inference/dynamic/@pearl_dbn_inf_engine/private/init_pearl_dbn_ev_msgs.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 msg = init_pearl_dbn_ev_msgs(bnet, evidence, engine) |
wolffd@0 | 2 |
wolffd@0 | 3 [ss T] = size(evidence); |
wolffd@0 | 4 pot_type = 'd'; |
wolffd@0 | 5 |
wolffd@0 | 6 % each hidden node absorbs lambda from its observed child (if any) |
wolffd@0 | 7 for t=1:T |
wolffd@0 | 8 for i=hnodes |
wolffd@0 | 9 c = engine.obschild(i); |
wolffd@0 | 10 if c > 0 |
wolffd@0 | 11 if t==1 |
wolffd@0 | 12 fam = family(bnet.dag, c); |
wolffd@0 | 13 e = bnet.equiv_class(c, 1); |
wolffd@0 | 14 CPDpot = CPD_to_pot(pot_type, bnet.CPD{e}, fam, bnet.node_sizes(:), bnet.cnodes(:), evidence(:,1)); |
wolffd@0 | 15 else |
wolffd@0 | 16 fam = family(bnet.dag, c, 2); % within 2 slice network |
wolffd@0 | 17 e = bnet.equiv_class(c, 2); |
wolffd@0 | 18 CPDpot = CPD_to_pot(pot_type, bnet.CPD{e}, fam, bnet.node_sizes(:), bnet.cnodes(:), evidence(:,t-1:t)); |
wolffd@0 | 19 end |
wolffd@0 | 20 temp = pot_to_marginal(CPDpot); |
wolffd@0 | 21 n = i + (t-1)*ss; |
wolffd@0 | 22 lam_msg = normalise(temp.T); |
wolffd@0 | 23 j = engine.child_index{n}(c+(t-1)*ss); |
wolffd@0 | 24 assert(j==1); |
wolffd@0 | 25 msg{n}.lambda_from_child{j} = lam_msg; |
wolffd@0 | 26 end |
wolffd@0 | 27 end |
wolffd@0 | 28 end |