comparison toolboxes/FullBNT-1.0.7/bnt/examples/static/HME/hme_topobuilder.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 [bnet, onodes]=hme_topobuilder(nodes_info);
2 %
3 % HME topology builder
4 %
5 % ----------------------------------------------------------------------------------------------------
6 % -> pierpaolo_b@hotmail.com or -> pampo@interfree.it
7 % ----------------------------------------------------------------------------------------------------
8
9 nodes_num=size(nodes_info,2);
10 dag = zeros(nodes_num);
11 list=[1:nodes_num];
12 for i=1:(nodes_num-1)
13 app=[];
14 app=list((i+1):end);
15 dag(i,app) = 1;
16 end
17 onodes = [1 nodes_num];
18 dnodes = list(2:end-1);
19 if nodes_info(1,end)>0,
20 dnodes=[dnodes nodes_num];
21 end
22 ns = nodes_info(2,:);
23
24 bnet = mk_bnet(dag, ns, dnodes);
25 clamped = 0;
26
27 bnet.CPD{1} = root_CPD(bnet, 1);
28
29 rand('state', 50);
30 randn('state', 50);
31
32 for i=2:nodes_num,
33 if (nodes_info(1,i)==0)&(nodes_info(4,i)==1),
34 bnet.CPD{i} = gaussian_CPD(bnet, i, [], [], [], 'full');
35 elseif (nodes_info(1,i)==0)&(nodes_info(4,i)==2),
36 bnet.CPD{i} = gaussian_CPD(bnet, i, [], [], [], 'diag');
37 elseif (nodes_info(1,i)==0)&(nodes_info(4,i)==3),
38 bnet.CPD{i} = gaussian_CPD(bnet, i, [], [], [], 'full', 'tied');
39 elseif (nodes_info(1,i)==0)&(nodes_info(4,i)==4),
40 bnet.CPD{i} = gaussian_CPD(bnet, i, [], [], [], 'diag', 'tied');
41 elseif nodes_info(1,i)==1,
42 %bnet.CPD{i} = dsoftmax_CPD(bnet, i, [], [], clamped, nodes_info(4,i));
43 bnet.CPD{i} = softmax_CPD(bnet, i, 'clamped', clamped, 'max_iter', nodes_info(4,i));
44 else
45 bnet.CPD{i} = mlp_CPD(bnet, i, nodes_info(3,i), [], [], [], [], clamped, nodes_info(4,i));
46 end
47 end