wolffd@0
|
1 % Compare the speeds of various inference engines on the BAT DBN
|
wolffd@0
|
2 [bnet, names] = mk_bat_dbn;
|
wolffd@0
|
3
|
wolffd@0
|
4 T = 3; % fixed length sequence - we make it short just for speed
|
wolffd@0
|
5
|
wolffd@0
|
6 USEC = exist('@jtree_C_inf_engine/collect_evidence','file');
|
wolffd@0
|
7
|
wolffd@0
|
8 disp('constructing engines for BAT');
|
wolffd@0
|
9 engine = {}; % time in seconds for inference
|
wolffd@0
|
10 engine{end+1} = jtree_unrolled_dbn_inf_engine(bnet, T, 'useC', USEC); % 0.39
|
wolffd@0
|
11 engine{end+1} = smoother_engine(jtree_2TBN_inf_engine(bnet)); % 4.89
|
wolffd@0
|
12 engine{end+1} = jtree_dbn_inf_engine(bnet); % 4.45
|
wolffd@0
|
13 if 0
|
wolffd@0
|
14 engine{end+1} = jtree_ndx_dbn_inf_engine(bnet, 'ndx_type', 'SD'); % 2.98
|
wolffd@0
|
15 engine{end+1} = jtree_ndx_dbn_inf_engine(bnet, 'ndx_type', 'D'); % 3.52
|
wolffd@0
|
16 engine{end+1} = jtree_ndx_dbn_inf_engine(bnet, 'ndx_type', 'B'); % 2.40
|
wolffd@0
|
17 if USEC, engine{end+1} = jtree_C_dbn_inf_engine(bnet); end % 3.54
|
wolffd@0
|
18 %engine{end+1} = hmm_inf_engine(bnet, onodes); % too big
|
wolffd@0
|
19 end
|
wolffd@0
|
20
|
wolffd@0
|
21 %tic; engine{end+1} = frontier_inf_engine(bnet); toc % very slow
|
wolffd@0
|
22 % The frontier engine thrashes badly on the BAT network
|
wolffd@0
|
23 %tic; engine{end+1} = bk_inf_engine(bnet, 'exact', onodes); toc % SLOW!
|
wolffd@0
|
24
|
wolffd@0
|
25 %tic; engine{end+1} = bk_inf_engine(bnet, 'ff', onodes); toc
|
wolffd@0
|
26
|
wolffd@0
|
27 %clusters{1} = [stringmatch({'LeftClr', 'RightClr', 'LatAct', 'Xdot', 'InLane'}, names)];
|
wolffd@0
|
28 %clusters{2} = [stringmatch({'FwdAct', 'Ydot', 'Stopped', 'EngStatus', 'FBStatus'}, names)];
|
wolffd@0
|
29
|
wolffd@0
|
30 %tic; engine{end+1} = bk_inf_engine(bnet, clusters, onodes); toc
|
wolffd@0
|
31
|
wolffd@0
|
32 disp('inference')
|
wolffd@0
|
33 time = cmp_inference_dbn(bnet, engine, T)
|
wolffd@0
|
34
|
wolffd@0
|
35 disp('learning')
|
wolffd@0
|
36 time = cmp_learning_dbn(bnet, engine, T)
|
wolffd@0
|
37
|
wolffd@0
|
38
|
wolffd@0
|
39
|
wolffd@0
|
40
|
wolffd@0
|
41
|
wolffd@0
|
42
|
wolffd@0
|
43
|
wolffd@0
|
44
|