annotate toolboxes/FullBNT-1.0.7/bnt/examples/dynamic/ehmm1.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 % make the structure of an embedded HMM with 2 rows and 3 columns
wolffd@0 2
wolffd@0 3 % 1------------>2
wolffd@0 4 % |\ \ | \ \
wolffd@0 5 % 3->4->5 6->7->8
wolffd@0 6
wolffd@0 7 n = 8;
wolffd@0 8 dag = zeros(n);
wolffd@0 9 dag(1,[2 3 4 5])=1;
wolffd@0 10 dag(2,[6 7 8])=1;
wolffd@0 11 for i=3:4
wolffd@0 12 dag(i,i+1)=1;
wolffd@0 13 end
wolffd@0 14 for i=6:7
wolffd@0 15 dag(i,i+1)=1;
wolffd@0 16 end
wolffd@0 17 ns = 2*ones(1,n);
wolffd@0 18 bnet = mk_bnet(dag,ns);
wolffd@0 19 for i=1:n
wolffd@0 20 bnet.CPD{i}=tabular_CPD(bnet,i);
wolffd@0 21 end
wolffd@0 22 [jtree, root, cliques] = graph_to_jtree(moralize(bnet.dag), ones(1,n), {}, {});
wolffd@0 23 %[jtree, root, cliques, B, w, elim_order, moral_edges, fill_in_edges] = dag_to_jtree(bnet);
wolffd@0 24