To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / _FullBNT / BNT / CPDs / @discrete_CPD / CPD_to_lambda_msg.m @ 8:b5b38998ef3b
History | View | Annotate | Download (586 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 (discrete) |
| 3 |
% lam_msg = compute_lambda_msg(CPD, msg_type, n, ps, msg, p, evidence) |
| 4 |
% Pearl p183 eq 4.52 |
| 5 |
|
| 6 |
switch msg_type |
| 7 |
case 'd', |
| 8 |
T = prod_CPT_and_pi_msgs(CPD, n, ps, msg, p); |
| 9 |
mysize = length(msg{n}.lambda);
|
| 10 |
lambda = dpot(n, mysize, msg{n}.lambda);
|
| 11 |
T = multiply_by_pot(T, lambda); |
| 12 |
lam_msg = pot_to_marginal(marginalize_pot(T, p)); |
| 13 |
lam_msg = lam_msg.T; |
| 14 |
case 'g', |
| 15 |
error('discrete_CPD can''t create Gaussian msgs')
|
| 16 |
end |