wolffd@0: % Compare the speeds of various inference engines on the BAT DBN wolffd@0: [bnet, names] = mk_bat_dbn; wolffd@0: wolffd@0: T = 3; % fixed length sequence - we make it short just for speed wolffd@0: wolffd@0: USEC = exist('@jtree_C_inf_engine/collect_evidence','file'); wolffd@0: wolffd@0: disp('constructing engines for BAT'); wolffd@0: engine = {}; % time in seconds for inference wolffd@0: engine{end+1} = jtree_unrolled_dbn_inf_engine(bnet, T, 'useC', USEC); % 0.39 wolffd@0: engine{end+1} = smoother_engine(jtree_2TBN_inf_engine(bnet)); % 4.89 wolffd@0: engine{end+1} = jtree_dbn_inf_engine(bnet); % 4.45 wolffd@0: if 0 wolffd@0: engine{end+1} = jtree_ndx_dbn_inf_engine(bnet, 'ndx_type', 'SD'); % 2.98 wolffd@0: engine{end+1} = jtree_ndx_dbn_inf_engine(bnet, 'ndx_type', 'D'); % 3.52 wolffd@0: engine{end+1} = jtree_ndx_dbn_inf_engine(bnet, 'ndx_type', 'B'); % 2.40 wolffd@0: if USEC, engine{end+1} = jtree_C_dbn_inf_engine(bnet); end % 3.54 wolffd@0: %engine{end+1} = hmm_inf_engine(bnet, onodes); % too big wolffd@0: end wolffd@0: wolffd@0: %tic; engine{end+1} = frontier_inf_engine(bnet); toc % very slow wolffd@0: % The frontier engine thrashes badly on the BAT network wolffd@0: %tic; engine{end+1} = bk_inf_engine(bnet, 'exact', onodes); toc % SLOW! wolffd@0: wolffd@0: %tic; engine{end+1} = bk_inf_engine(bnet, 'ff', onodes); toc wolffd@0: wolffd@0: %clusters{1} = [stringmatch({'LeftClr', 'RightClr', 'LatAct', 'Xdot', 'InLane'}, names)]; wolffd@0: %clusters{2} = [stringmatch({'FwdAct', 'Ydot', 'Stopped', 'EngStatus', 'FBStatus'}, names)]; wolffd@0: wolffd@0: %tic; engine{end+1} = bk_inf_engine(bnet, clusters, onodes); toc wolffd@0: wolffd@0: disp('inference') wolffd@0: time = cmp_inference_dbn(bnet, engine, T) wolffd@0: wolffd@0: disp('learning') wolffd@0: time = cmp_learning_dbn(bnet, engine, T) wolffd@0: wolffd@0: wolffd@0: wolffd@0: wolffd@0: wolffd@0: wolffd@0: wolffd@0: