annotate toolboxes/FullBNT-1.0.7/bnt/inference/online/@hmm_2TBN_inf_engine/fwd.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] = fwd(engine, fpast, ev, t)
wolffd@0 2 % Forwards pass.
wolffd@0 3
wolffd@0 4 f.obslik = mk_hmm_obs_lik_vec(engine, ev);
wolffd@0 5 transmat = engine.transprob;
wolffd@0 6 f.past_alpha = fpast.alpha;
wolffd@0 7 if engine.maximize
wolffd@0 8 Q = length(fpast.alpha);
wolffd@0 9 A = repmat(fpast.alpha, [1 Q]);
wolffd@0 10 m = max(transmat .* A, [], 1);
wolffd@0 11 [f.alpha, scale] = normalise(m(:) .* f.obslik);
wolffd@0 12 else
wolffd@0 13 [f.alpha, scale] = normalise((transmat' * fpast.alpha) .* f.obslik);
wolffd@0 14 end
wolffd@0 15 logscale = log(scale);
wolffd@0 16 %f.xi = normalise((fpast.alpha * obslik') .* transmat); % t-1,t
wolffd@0 17 f.t = t;