annotate toolboxes/FullBNT-1.0.7/bnt/examples/dynamic/bat1.m @ 0:cc4b1211e677 tip

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