about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/BNT/inference/static/@jtree_inf_engine/distribute_evidence.m
blob: 403b89706b192479c9309101b2a95e54f4f8f556 (plain)
1
2
3
4
5
6
7
8
9
10
11
function [clpot, seppot] = distribute_evidence(engine, clpot, seppot)
% DISTRIBUTE_EVIDENCE Do message passing from root to leaves (parents then children)
% [clpot, seppot] = distribute_evidence(engine, clpot, seppot)

for n=engine.preorder
  for c=engine.preorder_children{n}
    clpot{c} = divide_by_pot(clpot{c}, seppot{n,c}); 
    seppot{n,c} = marginalize_pot(clpot{n}, engine.separator{n,c}, engine.maximize);
    clpot{c} = multiply_by_pot(clpot{c}, seppot{n,c});
  end
end