diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toolboxes/FullBNT-1.0.7/bnt/inference/online/@hmm_2TBN_inf_engine/fwd.m	Tue Feb 10 15:05:51 2015 +0000
@@ -0,0 +1,17 @@
+function [f, logscale] = fwd(engine, fpast, ev, t)
+% Forwards pass.
+
+f.obslik = mk_hmm_obs_lik_vec(engine, ev);
+transmat = engine.transprob;
+f.past_alpha = fpast.alpha;
+if engine.maximize
+  Q = length(fpast.alpha);
+  A = repmat(fpast.alpha, [1 Q]);
+  m = max(transmat .* A, [], 1);
+  [f.alpha, scale] = normalise(m(:) .* f.obslik);
+else
+  [f.alpha, scale] = normalise((transmat' * fpast.alpha) .* f.obslik);
+end
+logscale = log(scale);
+%f.xi = normalise((fpast.alpha * obslik') .* transmat); % t-1,t
+f.t = t;