annotate toolboxes/FullBNT-1.0.7/bnt/examples/static/Belprop/belprop_loopy_cg.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 % Same as cg1, except we assume all discretes are observed,
wolffd@0 2 % and use loopy for approximate inference.
wolffd@0 3
wolffd@0 4 ns = 2*ones(1,9);
wolffd@0 5 F = 1; W = 2; E = 3; B = 4; C = 5; D = 6; Min = 7; Mout = 8; L = 9;
wolffd@0 6 n = 9;
wolffd@0 7 dnodes = [B F W];
wolffd@0 8 cnodes = mysetdiff(1:n, dnodes);
wolffd@0 9
wolffd@0 10 %bnet = mk_incinerator_bnet(ns);
wolffd@0 11 bnet = mk_incinerator_bnet;
wolffd@0 12
wolffd@0 13 bnet.observed = [dnodes E];
wolffd@0 14
wolffd@0 15 engines = {};
wolffd@0 16 engines{end+1} = jtree_inf_engine(bnet);
wolffd@0 17 engines{end+1} = pearl_inf_engine(bnet, 'protocol', 'parallel');
wolffd@0 18 nengines = length(engines);
wolffd@0 19
wolffd@0 20
wolffd@0 21 [time, engines] = cmp_inference_static(bnet, engines, 'maximize', 0, 'check_ll', 0, ...
wolffd@0 22 'singletons_only', 0, 'exact', 1, 'check_converged', 2);