comparison toolboxes/FullBNT-1.0.7/HMM/dhmm_logprob.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 [loglik, errors] = dhmm_logprob(data, prior, transmat, obsmat)
2 % LOG_LIK_DHMM Compute the log-likelihood of a dataset using a discrete HMM
3 % [loglik, errors] = log_lik_dhmm(data, prior, transmat, obsmat)
4 %
5 % data{m} or data(m,:) is the m'th sequence
6 % errors is a list of the cases which received a loglik of -infinity
7
8 if ~iscell(data)
9 data = num2cell(data, 2);
10 end
11 ncases = length(data);
12
13 loglik = 0;
14 errors = [];
15 for m=1:ncases
16 obslik = multinomial_prob(data{m}, obsmat);
17 [alpha, beta, gamma, ll] = fwdback(prior, transmat, obslik, 'fwd_only', 1);
18 if ll==-inf
19 errors = [errors m];
20 end
21 loglik = loglik + ll;
22 end