comparison toolboxes/FullBNT-1.0.7/bnt/inference/dynamic/@cbk_inf_engine/marginal_family.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 m = marginal_family(engine, i, t)
2 % MARGINAL_FAMILY Compute the marginal on the specified family (bk)
3 % marginal = marginal_family(engine, i, t)
4
5 % This is just like inf_engine/marginal_family, except when we call
6 % marginal_nodes, we provide a 4th argument, to tell it's a family.
7
8 if nargin < 3, t = 1; end
9
10 bnet = bnet_from_engine(engine);
11 if t==1
12 m = marginal_nodes(engine, family(bnet.dag, i), t, 1);
13 else
14 ss = length(bnet.intra);
15 fam = family(bnet.dag, i+ss);
16 if any(fam<=ss)
17 % i has a parent in the preceeding slice
18 % Hence the lowest numbered slice containing the family is t-1
19 m = marginal_nodes(engine, fam, t-1, 1);
20 else
21 % The family all fits inside slice t
22 % Hence shift the indexes back to slice 1
23 m = marginal_nodes(engine, fam-ss, t, 1);
24 end
25 end