comparison toolboxes/FullBNT-1.0.7/KPMstats/condGaussToJoint.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function [muXY, SigmaXY] = condGaussToJoint(muX, SigmaX, muY, SigmaY, WYgivenX)
2
3 % Compute P(X,Y) from P(X) * P(Y|X) where P(X)=N(X;muX,SigmaX)
4 % and P(Y|X) = N(Y; WX + muY, SigmaY)
5
6 % For details on how to compute a Gaussian from a Bayes net
7 % - "Gaussian Influence Diagrams", R. Shachter and C. R. Kenley, Management Science, 35(5):527--550, 1989.
8
9 % size(W) = dy x dx
10 dx = length(muX);
11 dy = length(muY);
12 muXY = [muX(:); WYgivenX*muX(:) + muY];
13
14 W = [zeros(dx,dx) WYgivenX';
15 zeros(dy,dx) zeros(dy,dy)];
16 D = [SigmaX zeros(dx,dy);
17 zeros(dy,dx) SigmaY];
18
19 U = inv(eye(size(W)) - W')';
20 SigmaXY = U' * D * U;
21
22