annotate toolboxes/FullBNT-1.0.7/bnt/inference/online/@smoother_engine/enter_evidence.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 [engine, LL] = enter_evidence(engine, ev)
wolffd@0 2 % ENTER_EVIDENCE Call the offline smoother
wolffd@0 3 % [engine, loglik] = enter_evidence(engine, evidence, ...)
wolffd@0 4 %
wolffd@0 5 % evidence{i,t} = [] if if X(i,t) is hidden, and otherwise contains its observed value (scalar or column vector)
wolffd@0 6 %
wolffd@0 7
wolffd@0 8 T = size(ev, 2);
wolffd@0 9 f = cell(1,T);
wolffd@0 10 b = cell(1,T); % b{t}.clpot{c}
wolffd@0 11 ll = zeros(1,T);
wolffd@0 12 [f{1}, ll(1)] = fwd1(engine.tbn_engine, ev(:,1), 1);
wolffd@0 13 for t=2:T
wolffd@0 14 [f{t}, ll(t)] = fwd(engine.tbn_engine, f{t-1}, ev(:,t), t);
wolffd@0 15 end
wolffd@0 16 LL = sum(ll);
wolffd@0 17 b{T} = backT(engine.tbn_engine, f{T}, T);
wolffd@0 18 for t=T-1:-1:1
wolffd@0 19 b{t} = back(engine.tbn_engine, b{t+1}, f{t}, t);
wolffd@0 20 end
wolffd@0 21 engine.b = b;