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