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