Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/bnt/examples/static/Belprop/bp1.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 % Compare different loopy belief propagation algorithms on a graph with a single loop. | |
2 % LBP should give exact results if it converges. | |
3 | |
4 seed = 0; | |
5 rand('state', seed); | |
6 randn('state', seed); | |
7 | |
8 N = 2; | |
9 dag = zeros(N,N); | |
10 dag(1,2)=1; | |
11 ns = ones(1,N); | |
12 bnet = mk_bnet(dag, ns, 'discrete', []); | |
13 for i=1:N | |
14 %bnet.CPD{i} = gaussian_CPD(bnet, i, 'mean', 0); | |
15 bnet.CPD{i} = gaussian_CPD(bnet, i); | |
16 end | |
17 | |
18 engines = {}; | |
19 engines{end+1} = jtree_inf_engine(bnet); | |
20 engines{end+1} = pearl_inf_engine(bnet, 'protocol', 'tree'); | |
21 | |
22 [time, engines] = cmp_inference_static(bnet, engines, 'maximize', 0, 'exact', 1:2, 'observed', [2], ... | |
23 'check_ll', 0, 'singletons_only', 1, 'check_converged', []); | |
24 |