📄 hmmapiup.m
字号:
function [A,pi] = hmmApiup(y,alpha,beta,f,HMM)
%
% Update the A and pi probabilities in the HMM using the forward and
% backward probabilities alpha and beta
%
% function [A,pi] = hmmapiup(y,alpha,beta,HMM)
%
% y = input sequence
% alpha = forward probability
% beta = backward probability
% f = distribution
% HMM = model parameters
%
% A = updated state transition probability
% pi = updated initial state probability
% Copyright 1999 by Todd K. Moon
[S,S] = size(HMM.A); [m,T] = size(y);
A = HMM.A;
for j=1:S % from state
d = alpha(j,1:end-1) * beta(j,1:end-1)'; % denominator
for i=1:S % to state
as = sum(HMM.A(i,j) *(alpha(j,1:end-1) .* f(2:end,i)' .* beta(i,2:end)));
A(i,j) = as/d;
end
end
Pym = sum(alpha(:,1).* beta(:,1));
pi = alpha(:,1).*beta(:,1)/Pym;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -