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/SLP/examples/test_bnpc2.m | 44 ++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 sourcecodes/bnt-master/SLP/examples/test_bnpc2.m (limited to 'sourcecodes/bnt-master/SLP/examples/test_bnpc2.m') diff --git a/sourcecodes/bnt-master/SLP/examples/test_bnpc2.m b/sourcecodes/bnt-master/SLP/examples/test_bnpc2.m new file mode 100644 index 00000000..77d38334 --- /dev/null +++ b/sourcecodes/bnt-master/SLP/examples/test_bnpc2.m @@ -0,0 +1,44 @@ +% test BNPC +close all; +clear all; + +%test='pearson'; % Pearson's Chi2 +%test='LRT'; % Likelihood ratio test G2 +fprintf('\n=== Structure Learning with BN-PC (Power Constructor) algorithm\n'); + +n=8; +m=10000; +names={ 'A' , 'S' , 'T' , 'L' , 'B' , 'O' , 'X' , 'D' }; +names={ '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' }; +carre=ones(1,n); + +bnet=mk_asia2_bnet; +data = cell(n,m); +for l = 1:m, data(:,l) = sample_bnet(bnet); end +data=cell2mat(data); +fprintf('Complete data have been created.'); + +tmp=cputime; +[Phase_3 Phase_2 Phase_1 U] = learn_struct_bnpc(data); +%,2*ones(1,n),0.05,1); +tmp=cputime-tmp; +fprintf('\t- Execution time : %3.2f seconds\n',tmp); + +figure; +[xx yy] = make_layout(bnet.dag); +yy=(yy-0.2)*.8/.6+.1; +xx=(xx-0.2833)*.8/.517+.1; +subplot(2,3,1), [xx yy]=draw_graph(bnet.dag,names,carre,xx,yy); %,carre); +title('ASIA original graph'); +subplot(2,3,2), draw_graph(Phase_1,names,carre,xx,yy); %,carre); +title('BNPC Phase 1'); +subplot(2,3,3), draw_graph(Phase_2,names,carre,xx,yy); %,carre); +title('BNPC Phase 2'); +subplot(2,3,4), draw_graph(U,names,carre,xx,yy); %,carre); +title('BNPC Phase 3a'); +subplot(2,3,5), draw_graph(Phase_3,names,carre,xx,yy); %,carre); +title('BNPC Phase 3b'); +subplot(2,3,6), draw_graph(pdag_to_dag(Phase_3),names,carre,xx,yy); %,carre); +title('BNPC DAG'); +drawnow; + -- cgit 1.4.1