Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/bnt/inference/static/@belprop_inf_engine/Old/belprop_inf_engine_nostr.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 engine = belprop_inf_engine(fg, max_iter, momentum, tol, maximize) | |
2 | |
3 if nargin < 2, max_iter = length(fg.G); end | |
4 if nargin < 3, momentum = 0; end | |
5 if nargin < 4, tol = 1e-3; end | |
6 if nargin < 5, maximize = 0; end | |
7 | |
8 engine.fgraph = fg; | |
9 engine.max_iter = max_iter; | |
10 engine.momentum = momentum; | |
11 engine.tol = tol; | |
12 engine.maximize = maximize; | |
13 | |
14 % store results computed by enter_evidence here | |
15 ndoms = length(fg.doms); | |
16 nvars = length(fg.vars); | |
17 engine.marginal_domains = cell(1, ndoms); | |
18 | |
19 % to compute the marginal on each variable, we need to know which domain to marginalize | |
20 % so we represent each domain as a bit vector, and compute its (pre-evidence) weight | |
21 engine.dom_weight = []; | |
22 | |
23 % engine.dom_bitv = sparse(ndoms, nvars); | |
24 % ns = fg.node_sizes; | |
25 % for i=1:ndoms | |
26 % engine.dom_bitv(i, fg.doms{i}) = 1; | |
27 % engine.dom_weight(i) = prod(ns(fg.doms{i})); | |
28 % end | |
29 | |
30 | |
31 engine = class(engine, 'belprop_inf_engine'); |