comparison toolboxes/FullBNT-1.0.7/bnt/examples/static/gaussian1.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 % Make the following network (from Jensen (1996) p84 fig 4.17)
2 % 1
3 % / | \
4 % 2 3 4
5 % | | |
6 % 5 6 7
7 % \/ \/
8 % 8 9
9 % where all arcs point downwards
10
11
12 N = 9;
13 dag = zeros(N,N);
14 dag(1,2)=1; dag(1,3)=1; dag(1,4)=1;
15 dag(2,5)=1; dag(3,6)=1; dag(4,7)=1;
16 dag(5,8)=1; dag(6,8)=1; dag(6,9)=1; dag(7,9) = 1;
17
18 ns = [5 4 3 2 2 1 2 2 2]; % vector-valued nodes
19 %ns = ones(1,9); % scalar nodes
20 dnodes = [];
21
22 bnet = mk_bnet(dag, ns, 'discrete', []);
23 rand('state', 0);
24 randn('state', 0);
25 for i=1:N
26 bnet.CPD{i} = gaussian_CPD(bnet, i);
27 end
28
29 clear engine;
30 engine{1} = gaussian_inf_engine(bnet);
31 engine{2} = jtree_inf_engine(bnet);
32
33 [err, time] = cmp_inference_static(bnet, engine);
34