Mercurial > hg > camir-ismir2012
comparison toolboxes/FullBNT-1.0.7/HMM/dhmm_logprob.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 [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 |