comparison toolboxes/FullBNT-1.0.7/bnt/inference/dynamic/@ff_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
comparison
equal deleted inserted replaced
-1:000000000000 0:cc4b1211e677
1 function marginal = marginal_nodes(engine, nodes, t)
2 % MARGINAL_NODES Compute the marginal on the specified query nodes (ff)
3 % marginal = marginal_nodes(engine, i, t)
4 % returns Pr(X(i,t) | Y(1:T)), where X(i,t) is the i'th node in the t'th slice.
5 % If enter_evidence used filtering instead of smoothing, this will return Pr(X(i,t) | Y(1:t)).
6
7 if nargin < 3, t = 1; end
8 assert(length(nodes)==1);
9 i = nodes(end);
10 if myismember(i, engine.hnodes)
11 marginal = pot_to_marginal(engine.marginals{i,t});
12 else
13 marginal = pot_to_marginal(dpot(i, 1, 1)); % observed
14 end
15
16 bnet = bnet_from_engine(engine);
17 ss = length(bnet.intra);
18 % we convert the domain to the unrolled numbering system
19 % so that update_ess extracts the right evidence.
20 marginal.domain = nodes+(t-1)*ss;