annotate toolboxes/FullBNT-1.0.7/bnt/inference/dynamic/@bk_ff_hmm_inf_engine/dbn_update_bel.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, loglik] = dbn_update_bel(engine, evidence)
wolffd@0 2 % DBN_UPDATE_BEL Update the belief state (bk_ff_hmm)
wolffd@0 3 % [engine, loglik] = dbn_update_bel(engine, evidence)
wolffd@0 4 %
wolffd@0 5 % evidence{i,1} contains the evidence on node i in slice t-1
wolffd@0 6 % evidence{i,2} contains the evidence on node i in slice t
wolffd@0 7
wolffd@0 8 oldbel = engine.bel;
wolffd@0 9 bnet = bnet_from_engine(engine);
wolffd@0 10 obslik = mk_hmm_obs_lik_vec(bnet, evidence);
wolffd@0 11 [newbel, lik] = normalise((engine.transmat' * oldbel) .* obslik);
wolffd@0 12 loglik = log(lik);
wolffd@0 13
wolffd@0 14 hnodes = engine.hnodes;
wolffd@0 15 ns = bnet.node_sizes;
wolffd@0 16 [marginals, marginalsT] = project_joint_onto_marginals(newbel, hnodes, ns);
wolffd@0 17 newbel = combine_marginals_into_joint(marginalsT, hnodes, ns);
wolffd@0 18 engine.bel_marginals = marginalsT;
wolffd@0 19 engine.bel = newbel;