To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Revision:

root / _FullBNT / BNT / CPDs / @noisyor_CPD / CPD_to_lambda_msg.m @ 8:b5b38998ef3b

History | View | Annotate | Download (576 Bytes)

1
function lam_msg = CPD_to_lambda_msg(CPD, msg_type, n, ps, msg, p, evidence)
2
% CPD_TO_LAMBDA_MSG Compute lambda message (noisyor)
3
% lam_msg = CPD_to_lambda_msg(CPD, msg_type, n, ps, msg, p)
4
% Pearl p190 top eqn
5

    
6
switch msg_type
7
  case 'd', 
8
   l0 = msg{n}.lambda(1);
9
   l1 = msg{n}.lambda(2);
10
   Pi = sum_prod_CPD_and_pi_msgs(CPD, n, ps, msg, p);
11
   i = find(p==ps); % p is n's i'th parent
12
   q = CPD.inhibit(i);
13
   lam_msg = zeros(2,1);
14
   for u=0:1
15
     lam_msg(u+1) = l1 - (q^u)*(l1 - l0)*Pi;
16
   end       
17
 case 'g',
18
  error('noisyor_CPD can''t create Gaussian msgs')
19
end