annotate toolboxes/FullBNT-1.0.7/HMM/dhmm_logprob_brute_force.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 function logp = enumerate_HMM_loglik(prior, transmat, obsmat)
Daniel@0 2 % ENUMERATE_HMM_LOGLIK Compute the log likelihood of a sequence by exhaustive (O(Q^T)) enumeration.
Daniel@0 3 % logp = enumerate_HMM_loglik(prior, transmat, obsmat)
Daniel@0 4 %
Daniel@0 5 % Inputs:
Daniel@0 6 % prior(i) = Pr(Q(1) = i)
Daniel@0 7 % transmat(i,j) = Pr(Q(t+1)=j | Q(t)=i)
Daniel@0 8 % obsmat(i,t) = Pr(y(t) | Q(t)=i)
Daniel@0 9
Daniel@0 10 Q = length(prior);
Daniel@0 11 T = size(obsmat, 2);
Daniel@0 12 sizes = repmat(Q, 1, T);
Daniel@0 13
Daniel@0 14 psum = 0;
Daniel@0 15 for i=1:Q^T
Daniel@0 16 qs = ind2subv(sizes, i); % make the state sequence
Daniel@0 17 psum = psum + prob_path(prior, transmat, obsmat, qs);
Daniel@0 18 end
Daniel@0 19 logp = log(psum)
Daniel@0 20
Daniel@0 21