comparison toolboxes/FullBNT-1.0.7/HMM/dhmm_logprob_brute_force.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function logp = enumerate_HMM_loglik(prior, transmat, obsmat)
2 % ENUMERATE_HMM_LOGLIK Compute the log likelihood of a sequence by exhaustive (O(Q^T)) enumeration.
3 % logp = enumerate_HMM_loglik(prior, transmat, obsmat)
4 %
5 % Inputs:
6 % prior(i) = Pr(Q(1) = i)
7 % transmat(i,j) = Pr(Q(t+1)=j | Q(t)=i)
8 % obsmat(i,t) = Pr(y(t) | Q(t)=i)
9
10 Q = length(prior);
11 T = size(obsmat, 2);
12 sizes = repmat(Q, 1, T);
13
14 psum = 0;
15 for i=1:Q^T
16 qs = ind2subv(sizes, i); % make the state sequence
17 psum = psum + prob_path(prior, transmat, obsmat, qs);
18 end
19 logp = log(psum)
20
21