comparison toolboxes/FullBNT-1.0.7/HMM/dhmm_logprob_path.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
comparison
equal deleted inserted replaced
-1:000000000000 0:cc4b1211e677
1 function [ll, p] = prob_path(prior, transmat, obsmat, qs)
2 % PROB_PATH Compute the prob. of a specific path (state sequence) through an HMM.
3 % [ll, p] = prob_path(prior, transmat, obsmat, states)
4 %
5 % ll = log prob path
6 % p(t) = Pr(O(t)) * Pr(Q(t) -> Q(t+1)) for 1<=t<T, p(T) = Pr(O(T))
7
8 T = size(obsmat, 2);
9 p = zeros(1,T);
10 p(1) = prior(qs(1)) * obsmat(qs(1),1);
11 for t=2:T
12 p(t) = transmat(qs(t-1), qs(t)) * obsmat(qs(t),t);
13 end
14
15 ll = sum(log(p));