wolffd@0: function msg = init_pearl_dbn_ev_msgs(bnet, evidence, engine) wolffd@0: wolffd@0: [ss T] = size(evidence); wolffd@0: pot_type = 'd'; wolffd@0: wolffd@0: % each hidden node absorbs lambda from its observed child (if any) wolffd@0: for t=1:T wolffd@0: for i=hnodes wolffd@0: c = engine.obschild(i); wolffd@0: if c > 0 wolffd@0: if t==1 wolffd@0: fam = family(bnet.dag, c); wolffd@0: e = bnet.equiv_class(c, 1); wolffd@0: CPDpot = CPD_to_pot(pot_type, bnet.CPD{e}, fam, bnet.node_sizes(:), bnet.cnodes(:), evidence(:,1)); wolffd@0: else wolffd@0: fam = family(bnet.dag, c, 2); % within 2 slice network wolffd@0: e = bnet.equiv_class(c, 2); wolffd@0: CPDpot = CPD_to_pot(pot_type, bnet.CPD{e}, fam, bnet.node_sizes(:), bnet.cnodes(:), evidence(:,t-1:t)); wolffd@0: end wolffd@0: temp = pot_to_marginal(CPDpot); wolffd@0: n = i + (t-1)*ss; wolffd@0: lam_msg = normalise(temp.T); wolffd@0: j = engine.child_index{n}(c+(t-1)*ss); wolffd@0: assert(j==1); wolffd@0: msg{n}.lambda_from_child{j} = lam_msg; wolffd@0: end wolffd@0: end wolffd@0: end