annotate toolboxes/FullBNT-1.0.7/bnt/inference/dynamic/@hmm_inf_engine/marginal_nodes.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 marginal = marginal_nodes(engine, nodes, t, add_ev)
wolffd@0 2 % MARGINAL_NODES Compute the marginal on the specified query nodes (hmm)
wolffd@0 3 % marginal = marginal_nodes(engine, nodes, t, add_ev)
wolffd@0 4 %
wolffd@0 5 % 'nodes' must be a single node.
wolffd@0 6 % t is the time slice.
wolffd@0 7
wolffd@0 8 if nargin < 3, t = 1; end
wolffd@0 9 if nargin < 4, add_ev = 0; end
wolffd@0 10
wolffd@0 11 assert(length(nodes)==1)
wolffd@0 12 ss = engine.slice_size;
wolffd@0 13
wolffd@0 14 i = nodes(1);
wolffd@0 15 bigT = engine.one_slice_marginal(:,t);
wolffd@0 16 dom = i + (t-1)*ss;
wolffd@0 17
wolffd@0 18 ns = engine.eff_node_sizes(:);
wolffd@0 19 bigdom = 1:ss;
wolffd@0 20 marginal.T = marg_table(bigT, bigdom + (t-1)*ss, ns(bigdom), dom, engine.maximize);
wolffd@0 21
wolffd@0 22 marginal.domain = dom;
wolffd@0 23 marginal.mu = [];
wolffd@0 24 marginal.Sigma = [];
wolffd@0 25
wolffd@0 26 if add_ev
wolffd@0 27 marginal = add_ev_to_dmarginal(marginal, engine.evidence, engine.node_sizes);
wolffd@0 28 end
wolffd@0 29