comparison toolboxes/FullBNT-1.0.7/bnt/inference/static/@gaussian_inf_engine/gaussian_inf_engine.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 engine = gaussian_inf_engine(bnet)
2 % GAUSSIAN_INF_ENGINE Computes the joint multivariate Gaussian corresponding to the bnet
3 % engine = gaussian_inf_engine(bnet)
4 %
5 % For details on how to compute the joint Gaussian from the bnet, see
6 % - "Gaussian Influence Diagrams", R. Shachter and C. R. Kenley, Management Science, 35(5):527--550, 1989.
7 % Once we have the Gaussian, we can apply the standard formulas for conditioning and marginalization.
8
9 assert(isequal(bnet.cnodes, 1:length(bnet.dag)));
10
11 [W, D, mu] = extract_params_from_gbn(bnet);
12 U = inv(eye(size(W)) - W')';
13 Sigma = U' * D * U;
14
15 engine.mu = mu;
16 engine.Sigma = Sigma;
17 %engine.logp = log(normal_coef(Sigma));
18
19 % This is where we will store the results between enter_evidence and marginal_nodes
20 engine.Hmu = [];
21 engine.HSigma = [];
22 engine.hnodes = [];
23
24 engine = class(engine, 'gaussian_inf_engine', inf_engine(bnet));
25