Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/bnt/inference/dynamic/@hmm_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 marginal = marginal_family(engine, i, t, add_ev) | |
2 % MARGINAL_FAMILY Compute the marginal on the specified family (hmm) | |
3 % marginal = marginal_family(engine, i, t, add_ev) | |
4 | |
5 if nargin < 3, t = 1; end | |
6 if nargin < 4, add_ev = 0; end | |
7 | |
8 ns = engine.eff_node_sizes(:); | |
9 ss = engine.slice_size; | |
10 | |
11 if t==1 | ~engine.persist_bitv(i) | |
12 bigT = engine.one_slice_marginal(:,t); | |
13 ps = engine.parents{i}; | |
14 dom = [ps i] + (t-1)*ss; | |
15 bigdom = 1:ss; | |
16 bigsz = ns(bigdom); | |
17 bigdom = bigdom + (t-1)*ss; | |
18 else % some parents are in previous slice | |
19 bigT = engine.two_slice_marginal(:,t-1); % t-1 and t | |
20 ps = engine.parents{i+ss}; | |
21 dom = [ps i+ss] + (t-2)*ss; | |
22 bigdom = 1:(2*ss); % domain of xi(:,:,t) | |
23 bigsz = ns(bigdom); | |
24 bigdom = bigdom + (t-2)*ss; | |
25 end | |
26 marginal.domain = dom; | |
27 | |
28 marginal.T = marg_table(bigT, bigdom, bigsz, dom, engine.maximize); | |
29 marginal.mu = []; | |
30 marginal.Sigma = []; | |
31 | |
32 if add_ev | |
33 marginal = add_ev_to_dmarginal(marginal, engine.evidence, engine.node_sizes); | |
34 end | |
35 |