Mercurial > hg > camir-aes2014
annotate toolboxes/FullBNT-1.0.7/bnt/inference/dynamic/@bk_inf_engine/dbn_update_bel1.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_bel1(engine, evidence) |
wolffd@0 | 2 % DBN_UPDATE_BEL1 Update the initial belief state (bk) |
wolffd@0 | 3 % engine = dbn_update_bel1(engine, evidence) |
wolffd@0 | 4 % |
wolffd@0 | 5 % evidence{i} has the evidence on node i for slice 1 |
wolffd@0 | 6 |
wolffd@0 | 7 bnet = bnet_from_engine(engine); |
wolffd@0 | 8 ss = length(bnet.intra); |
wolffd@0 | 9 CPDpot = cell(1,ss); |
wolffd@0 | 10 t = 1; |
wolffd@0 | 11 for n=1:ss |
wolffd@0 | 12 fam = family(bnet.dag, n); |
wolffd@0 | 13 e = bnet.equiv_class(n, 1); |
wolffd@0 | 14 CPDpot{n} = convert_to_pot(bnet.CPD{e}, engine.pot_type, fam(:), evidence); |
wolffd@0 | 15 end |
wolffd@0 | 16 |
wolffd@0 | 17 onodes = find(~isemptycell(evidence)); |
wolffd@0 | 18 |
wolffd@0 | 19 [clpot, loglik] = enter_soft_evidence(engine.sub_engine1, engine.clq_ass_to_node1, CPDpot, onodes, engine.pot_type); |
wolffd@0 | 20 |
wolffd@0 | 21 C = length(engine.clusters); |
wolffd@0 | 22 newbel = cell(1,C); |
wolffd@0 | 23 for c=1:C |
wolffd@0 | 24 k = engine.clq_ass_to_cluster1(c); |
wolffd@0 | 25 newbel{c} = marginalize_pot(clpot{k}, engine.clusters{c}); |
wolffd@0 | 26 end |
wolffd@0 | 27 |
wolffd@0 | 28 engine.bel = newbel; |
wolffd@0 | 29 engine.bel_clpot = clpot; |
wolffd@0 | 30 engine.slice1 = 1; |