From 8070dc963753142bb86c4ed698d91fd623ed28e7 Mon Sep 17 00:00:00 2001 From: ziejd2 Date: Thu, 28 Sep 2017 15:04:40 -0500 Subject: BNW using Octave instead of Matlab. This version of BNW should perform the same as the original version. The only difference is that it uses Octave instead of Matlab when running BayesNet Toolbox during parameter learning. I am calling this BNW_1.02. It can be accessed at: compbio.uthsc.edu/BNW_1.02 --- sourcecodes/bnt-master/graph/triangulate_test.m | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 sourcecodes/bnt-master/graph/triangulate_test.m (limited to 'sourcecodes/bnt-master/graph/triangulate_test.m') diff --git a/sourcecodes/bnt-master/graph/triangulate_test.m b/sourcecodes/bnt-master/graph/triangulate_test.m new file mode 100644 index 00000000..70083d1c --- /dev/null +++ b/sourcecodes/bnt-master/graph/triangulate_test.m @@ -0,0 +1,36 @@ +% Test the code using the dag in Fig 1 of Jensen, Jensen, Dittmer, +% "From influence diagrams to junction trees", UAI 94 + +% By reverse enginering Fig 2, we infer that the following arcs should +% be absent from the original dag: b->d1, e->d2, f->d2, g->d4 +a=1; b=2; d1=3; c=4; d=5; e=6; f=7; g=8; d2=9; d4=10; i=11; h=12; d3=13; l=14; j=15; k=16; +dag=zeros(16); +dag(a,c)=1; +%dag(b,[c d d1])=1; +dag(b,[c d])=1; +dag(d1,d)=1; +dag(c,e)=1; +dag(d,[e f])=1; +%dag(e,[g d2])=1; +dag(e,[g])=1; +%dag(f,[d2 h])=1; +dag(f,[h])=1; +%dag(g,[d4 i])=1; +dag(g,[i])=1; +dag(d2,i)=1; +dag(d4,l)=1; +dag(i,l)=1; +dag(h,[j k])=1; +dag(d3,k)=1; + + +[MG, moral_edges] = moralize(dag); +MG(j,k)=1; MG(k,j)=1; % simulate having a common utility child +% MG now equals fig 2 +order = [l j k i h a c d d4 g d3 d2 f e d1 b]; +[MTG, cliques, fill_ins] = triangulate(MG, order); +% MTG equals fig 3 +ns = 2*ones(1,16); +[jtree, root, cliques2] = mk_strong_jtree(cliques, ns, order, MTG); +jtree2 = mk_rooted_tree(jtree, root); +% jtree2 equals fig 4, with their arrows reversed -- cgit 1.4.1