comparison toolboxes/FullBNT-1.0.7/bnt/inference/dynamic/@ff_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
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
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;