annotate toolboxes/FullBNT-1.0.7/bnt/inference/dynamic/@hmm_inf_engine/marginal_nodes.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function marginal = marginal_nodes(engine, nodes, t, add_ev)
Daniel@0 2 % MARGINAL_NODES Compute the marginal on the specified query nodes (hmm)
Daniel@0 3 % marginal = marginal_nodes(engine, nodes, t, add_ev)
Daniel@0 4 %
Daniel@0 5 % 'nodes' must be a single node.
Daniel@0 6 % t is the time slice.
Daniel@0 7
Daniel@0 8 if nargin < 3, t = 1; end
Daniel@0 9 if nargin < 4, add_ev = 0; end
Daniel@0 10
Daniel@0 11 assert(length(nodes)==1)
Daniel@0 12 ss = engine.slice_size;
Daniel@0 13
Daniel@0 14 i = nodes(1);
Daniel@0 15 bigT = engine.one_slice_marginal(:,t);
Daniel@0 16 dom = i + (t-1)*ss;
Daniel@0 17
Daniel@0 18 ns = engine.eff_node_sizes(:);
Daniel@0 19 bigdom = 1:ss;
Daniel@0 20 marginal.T = marg_table(bigT, bigdom + (t-1)*ss, ns(bigdom), dom, engine.maximize);
Daniel@0 21
Daniel@0 22 marginal.domain = dom;
Daniel@0 23 marginal.mu = [];
Daniel@0 24 marginal.Sigma = [];
Daniel@0 25
Daniel@0 26 if add_ev
Daniel@0 27 marginal = add_ev_to_dmarginal(marginal, engine.evidence, engine.node_sizes);
Daniel@0 28 end
Daniel@0 29