diff options
| author | ziejd2 | 2017-09-28 15:04:40 -0500 |
|---|---|---|
| committer | ziejd2 | 2017-09-28 15:04:40 -0500 |
| commit | 8070dc963753142bb86c4ed698d91fd623ed28e7 (patch) | |
| tree | d0f6dd8fc46a49b819aa55c1a90faa14d8448883 /sourcecodes/bnt-master/SLP/examples/test_bnpc.m | |
| parent | 7cc31810d53176e805532b2789955f4eedbce6bb (diff) | |
| download | BNW-8070dc963753142bb86c4ed698d91fd623ed28e7.tar.gz | |
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
Diffstat (limited to 'sourcecodes/bnt-master/SLP/examples/test_bnpc.m')
| -rw-r--r-- | sourcecodes/bnt-master/SLP/examples/test_bnpc.m | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/SLP/examples/test_bnpc.m b/sourcecodes/bnt-master/SLP/examples/test_bnpc.m new file mode 100644 index 00000000..85a21db3 --- /dev/null +++ b/sourcecodes/bnt-master/SLP/examples/test_bnpc.m @@ -0,0 +1,51 @@ +close all +clear all + +N=5; +names={'A','B','C','D','E'}; +dag=zeros(N); +dag(1,2)=1; +dag(2,[3 4])=1; +dag([3 4],5)=1; +[xx yy] = draw_graph(dag,names,ones(N,1)); +title('Cheng example.'); + +node_sizes=2*ones(1,N); +bnet=mk_bnet(dag,node_sizes); + +if 1 + disp('Generating DataSet'); + bnet.CPD{1} = tabular_CPD(bnet, 1, [0.4 0.6]); + bnet.CPD{2} = tabular_CPD(bnet, 2, [0.2 0.3 0.8 0.7]); + bnet.CPD{3} = tabular_CPD(bnet, 3, [0.1 0.2 0.9 0.8]); + bnet.CPD{4} = tabular_CPD(bnet, 4, [0.6 0.8 0.4 0.2]); + bnet.CPD{5} = tabular_CPD(bnet, 5, [0.9 0.8 0.7 0.6 0.1 0.2 0.3 0.4]); + m=10000; + cheng = cell(N,m); + for i=1:m + cheng(:,i)=sample_bnet(bnet); + end + cheng = cell2num(cheng); + %save -ascii cheng cheng +else + load -ascii cheng.mat +end + +% profile clear +% profile on + [Phase_3, Phase_2, Phase_1, UPhase_3] = learn_struct_bnpc(cheng, node_sizes, 0.05, 0) +% profile off +% profile report report_cheng + +figure +draw_graph(Phase_1,names,ones(N,1),xx,yy); +title('PhaseI'); +figure +draw_graph(Phase_2,names,ones(N,1),xx,yy); +title('PhaseII'); +%figure +%draw_graph(UPhase_3,names,ones(N,1),xx,yy); +%title('undirected PhaseIII'); +figure +draw_graph(Phase_3,names,ones(N,1),xx,yy); +title('PhaseIII'); |
