wolffd@0: function [engine, loglik] = dbn_update_bel1(engine, evidence) wolffd@0: % DBN_UPDATE_BEL Update the initial belief state (bk_ff_hmm) wolffd@0: % [engine, loglik] = dbn_update_bel(engine, evidence) wolffd@0: % wolffd@0: % evidence{i} contains the evidence on node i in slice 1 wolffd@0: wolffd@0: oldbel = engine.bel; wolffd@0: bnet = bnet_from_engine(engine); wolffd@0: obslik = mk_hmm_obs_lik_vec1(bnet, evidence); wolffd@0: [newbel, lik] = normalise(oldbel .* obslik); wolffd@0: loglik = log(lik); wolffd@0: wolffd@0: hnodes = engine.hnodes; wolffd@0: ns = bnet.node_sizes; wolffd@0: [marginals, marginalsT] = project_joint_onto_marginals(newbel, hnodes, ns); wolffd@0: newbel = combine_marginals_into_joint(marginalsT, hnodes, ns); wolffd@0: engine.bel_marginals = marginalsT; wolffd@0: engine.bel = newbel;