Mercurial > hg > camir-aes2014
annotate toolboxes/FullBNT-1.0.7/bnt/inference/online/@jtree_sparse_2TBN_inf_engine/fwd1.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 [f, logscale] = fwd1(engine, ev, t) |
wolffd@0 | 2 % Forwards pass for slice 1. |
wolffd@0 | 3 |
wolffd@0 | 4 bnet = bnet_from_engine(engine); |
wolffd@0 | 5 ss = bnet.nnodes_per_slice; |
wolffd@0 | 6 |
wolffd@0 | 7 CPDpot = cell(1,ss); |
wolffd@0 | 8 for n=1:ss |
wolffd@0 | 9 fam = family(bnet.dag, n, 1); |
wolffd@0 | 10 e = bnet.equiv_class(n, 1); |
wolffd@0 | 11 CPDpot{n} = convert_to_pot(bnet.CPD{e}, engine.pot_type, fam(:), ev); |
wolffd@0 | 12 end |
wolffd@0 | 13 f.evidence = ev; |
wolffd@0 | 14 f.t = t; |
wolffd@0 | 15 |
wolffd@0 | 16 pots = CPDpot; |
wolffd@0 | 17 slice1 = 1:ss; |
wolffd@0 | 18 CPDclqs = engine.clq_ass_to_node1(slice1); |
wolffd@0 | 19 |
wolffd@0 | 20 [f.clpot, f.seppot] = init_pot(engine.jtree_engine1, CPDclqs, CPDpot, engine.pot_type, engine.observed1); |
wolffd@0 | 21 [f.clpot, f.seppot] = collect_evidence(engine.jtree_engine1, f.clpot, f.seppot); |
wolffd@0 | 22 for c=1:length(f.clpot) |
wolffd@0 | 23 if isa(f.clpot{c}, 'struct') |
wolffd@0 | 24 domain = f.clpot{c}.domain; |
wolffd@0 | 25 sizes = f.clpot{c}.sizes; |
wolffd@0 | 26 T = f.clpot{c}.T; |
wolffd@0 | 27 f.clpot{c} = dpot(domain, sizes, T); |
wolffd@0 | 28 end |
wolffd@0 | 29 [f.clpot{c}, ll(c)] = normalize_pot(f.clpot{c}); |
wolffd@0 | 30 end |
wolffd@0 | 31 logscale = ll(engine.root1); |
wolffd@0 | 32 |