wolffd@0: function engine = bk_ff_hmm_inf_engine(bnet) wolffd@0: % BK_FF_HMM_INF_ENGINE Naive (HMM-based) implementation of fully factored form of Boyen-Koller wolffd@0: % engine = bk_ff_hmm_inf_engine(bnet) wolffd@0: % wolffd@0: % This is implemented on top of the forwards-backwards algo for HMMs, wolffd@0: % so it is *less* efficient than exact inference! However, it is good for educational purposes, wolffd@0: % because it illustrates the BK algorithm very clearly. wolffd@0: wolffd@0: [persistent_nodes, transient_nodes] = partition_dbn_nodes(bnet.intra, bnet.inter); wolffd@0: assert(isequal(sort(bnet.observed), transient_nodes)); wolffd@0: [engine.prior, engine.transmat] = dbn_to_hmm(bnet); wolffd@0: wolffd@0: ss = length(bnet.intra); wolffd@0: wolffd@0: engine.bel = []; wolffd@0: engine.bel_marginals = []; wolffd@0: engine.marginals = []; wolffd@0: wolffd@0: wolffd@0: engine = class(engine, 'bk_ff_hmm_inf_engine', inf_engine(bnet)); wolffd@0: