Mercurial > hg > camir-aes2014
diff toolboxes/FullBNT-1.0.7/bnt/examples/static/Belprop/belprop_polytree_cg.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolboxes/FullBNT-1.0.7/bnt/examples/static/Belprop/belprop_polytree_cg.m Tue Feb 10 15:05:51 2015 +0000 @@ -0,0 +1,33 @@ +% Inference on a conditional Gaussian model + +% Make the following polytree, where all arcs point down + +% 1 2 +% \ / +% 3 +% / \ +% 4 5 + +N = 5; +dag = zeros(N,N); +dag(1,3) = 1; +dag(2,3) = 1; +dag(3, [4 5]) = 1; + +ns = [2 1 2 1 2]; + +dnodes = 1; +%onodes = [1 5]; +bnet = mk_bnet(dag, ns, 'discrete', dnodes, 'observed', dnodes); + +bnet.CPD{1} = tabular_CPD(bnet, 1); +for i=2:N + bnet.CPD{i} = gaussian_CPD(bnet, i); +end + +engine = {}; +engine{end+1} = jtree_inf_engine(bnet); +engine{end+1} = pearl_inf_engine(bnet, 'protocol', 'parallel'); + +[time, engine] = cmp_inference_static(bnet, engine, 'maximize', 0, 'check_ll', 0, ... + 'singletons_only', 0, 'observed', [1 3]);