Mercurial > hg > camir-aes2014
annotate toolboxes/FullBNT-1.0.7/bnt/inference/dynamic/@bk_ff_hmm_inf_engine/bk_ff_hmm_inf_engine.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
rev | line source |
---|---|
wolffd@0 | 1 function engine = bk_ff_hmm_inf_engine(bnet) |
wolffd@0 | 2 % BK_FF_HMM_INF_ENGINE Naive (HMM-based) implementation of fully factored form of Boyen-Koller |
wolffd@0 | 3 % engine = bk_ff_hmm_inf_engine(bnet) |
wolffd@0 | 4 % |
wolffd@0 | 5 % This is implemented on top of the forwards-backwards algo for HMMs, |
wolffd@0 | 6 % so it is *less* efficient than exact inference! However, it is good for educational purposes, |
wolffd@0 | 7 % because it illustrates the BK algorithm very clearly. |
wolffd@0 | 8 |
wolffd@0 | 9 [persistent_nodes, transient_nodes] = partition_dbn_nodes(bnet.intra, bnet.inter); |
wolffd@0 | 10 assert(isequal(sort(bnet.observed), transient_nodes)); |
wolffd@0 | 11 [engine.prior, engine.transmat] = dbn_to_hmm(bnet); |
wolffd@0 | 12 |
wolffd@0 | 13 ss = length(bnet.intra); |
wolffd@0 | 14 |
wolffd@0 | 15 engine.bel = []; |
wolffd@0 | 16 engine.bel_marginals = []; |
wolffd@0 | 17 engine.marginals = []; |
wolffd@0 | 18 |
wolffd@0 | 19 |
wolffd@0 | 20 engine = class(engine, 'bk_ff_hmm_inf_engine', inf_engine(bnet)); |
wolffd@0 | 21 |