📄 mhmm_logprob.m
字号:
function [loglik, errors] = mhmm_logprob(data, prior, transmat, mu, Sigma, mixmat)% LOG_LIK_MHMM Compute the log-likelihood of a dataset using a (mixture of) Gaussians HMM% [loglik, errors] = log_lik_mhmm(data, prior, transmat, mu, sigma, mixmat)%% data{m}(:,t) or data(:,t,m) if all cases have same length% errors is a list of the cases which received a loglik of -infinity%% Set mixmat to ones(Q,1) or omit it if there is only 1 mixture componentQ = length(prior);if size(mixmat,1) ~= Q % trap old syntax error('mixmat should be QxM')endif nargin < 6, mixmat = ones(Q,1); endif ~iscell(data) data = num2cell(data, [1 2]); % each elt of the 3rd dim gets its own cellendncases = length(data);loglik = 0;errors = [];for m=1:ncases obslik = mixgauss_prob(data{m}, mu, Sigma, mixmat); [alpha, beta, gamma, ll] = fwdback(prior, transmat, obslik, 'fwd_only', 1); if ll==-inf errors = [errors m]; end loglik = loglik + ll;end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -