Mercurial > hg > camir-aes2014
annotate toolboxes/FullBNT-1.0.7/bnt/CPDs/@gmux_CPD/CPD_to_pi.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 pi = CPD_to_pi(CPD, msg_type, n, ps, msg, evidence) |
wolffd@0 | 2 % CPD_TO_PI Compute the pi vector (gaussian) |
wolffd@0 | 3 % function pi = CPD_to_pi(CPD, msg_type, n, ps, msg, evidence) |
wolffd@0 | 4 |
wolffd@0 | 5 switch msg_type |
wolffd@0 | 6 case 'd', |
wolffd@0 | 7 error('gaussian_CPD can''t create discrete msgs') |
wolffd@0 | 8 case 'g', |
wolffd@0 | 9 dps = ps(CPD.dps); |
wolffd@0 | 10 k = evidence{dps}; |
wolffd@0 | 11 if isempty(k) |
wolffd@0 | 12 error('gmux node must have observed discrete parent') |
wolffd@0 | 13 end |
wolffd@0 | 14 m = msg{n}.pi_from_parent{k}; |
wolffd@0 | 15 B = CPD.weights(:,:,k); |
wolffd@0 | 16 pi.mu = CPD.mean(:,k) + B * m.mu; |
wolffd@0 | 17 pi.Sigma = CPD.cov(:,:,k) + B * m.Sigma * B'; |
wolffd@0 | 18 end |