comparison toolboxes/FullBNT-1.0.7/bnt/examples/dynamic/chmm1.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 % Compare the speeds of various inference engines on a coupled HMM
2
3 N = 3;
4 Q = 2;
5 rand('state', 0);
6 randn('state', 0);
7 discrete = 0;
8 if discrete
9 Y = 2; % size of output alphabet
10 else
11 Y = 3; % size of observed vectors
12 end
13 coupled = 1;
14 bnet = mk_chmm(N, Q, Y, discrete, coupled);
15 %bnet = mk_fhmm(N, Q, Y, discrete); % factorial HMM
16 ss = length(bnet.node_sizes_slice);
17
18 T = 3;
19
20 USEC = exist('@jtree_C_inf_engine/collect_evidence','file');
21
22 engine = {};
23 engine{end+1} = jtree_dbn_inf_engine(bnet);
24 %engine{end+1} = jtree_ndx_dbn_inf_engine(bnet, 'ndx_type', 'SD');
25 %engine{end+1} = jtree_ndx_dbn_inf_engine(bnet, 'ndx_type', 'D');
26 %engine{end+1} = jtree_ndx_dbn_inf_engine(bnet, 'ndx_type', 'B');
27 if USEC, engine{end+1} = jtree_C_dbn_inf_engine(bnet); end
28 engine{end+1} = hmm_inf_engine(bnet);
29 engine{end+1} = jtree_unrolled_dbn_inf_engine(bnet, T);
30
31 % times in matlab N=4 Q=4 T=5 (* = winner)
32 % jtree SD B hmm dhmm unrolled
33 % 0.6266 1.1563 8.3815 0.3069 0.1948* 0.8654 inf
34 % 0.9057* 2.1522 12.6314 2.6847 2.3107 3.1905 learn
35
36 %engine{end+1} = bk_inf_engine(bnet, 'ff', onodes);
37 %engine{end+1} = pearl_unrolled_dbn_inf_engine(bnet, T);
38
39 inf_time = cmp_inference_dbn(bnet, engine, T)
40 learning_time = cmp_learning_dbn(bnet, engine, T)
41