資源簡介
HSMM程序(matlab)。HSMM是一個應用非常廣泛的模型。
代碼片段和文件信息
function?[PAIABPQestlkh]=hsmm_new(PAIABPOIterationNo)
%?
%?Author:?Shun-Zheng?Yu
%?Available:?http://sist.sysu.edu.cn/~syu/Publications/hsmm_new_m.txt
%?
%?HSMM?solve?three?fundamental?problems?for?Hidden?Semi-Markov?Model?using?a?new?Forward-Backward?algorithm
%?Usage:?[PAIABPStateseqLoglikelihood]=hsmm_newScale_amm(PAIABPOMaxIterationNo)
%?MaxIterationNo=0:?estimate?StateSeq?and?calculate?Loglikelihood?only;?
%?MaxIterationNo>1:?re-estimate?parameters?estimate?StateSeq?and?Loglikelihood.
%?First?use?[ABPPAIVkOK]=hsmmInitialize(OMDK)?to?initialize
%?
%?Ref:?Practical?Implementation?of?an?Efficient?Forward-Backward?Algorithm?for?an?Explicit?Duration?Hidden?Markov?Model
%?by?Shun-Zheng?Yu?and?H.?Kobayashi
%?IEEE?Transactions?on?Signal?Processing?Vol.?54?No.?5?MAY?2006?pp.?1947-1951?
%?
%??This?program?is?free?software;?you?can?redistribute?it?and/or
%??modify?it?under?the?terms?of?the?GNU?General?Public?License
%??as?published?by?the?Free?Software?Foundation;?either?version
%??2?of?the?License?or?(at?your?option)?any?later?version.
%??http://www.gnu.org/licenses/gpl.txt
%
%++++++++?Markov?Model?+++++++++++
M=length(PAI);???????????????%The?total?number?of?states
T=length(O);?????????????????%The?total?time
D=size(P2);?????????????????%The?maximum?duration?of?states
K=size(B2);?????????????????%The?total?number?of?observation?values
%----------------------------------------------------
ALPHA=zeros(MD);
bmx=zeros(MT);
S=zeros(MT);
E=zeros(MT);
BETA=ones(MD);
Ex=ones(MD);
Sx=ones(MD);
GAMMA=zeros(M1);
Pest=zeros(MD);
Aest=zeros(MM);
Best=zeros(MK);
Qest=zeros(T1);
ir1=max(1IterationNo);
for?ir=1:ir1
%????starttime=clock;
%++++++++++++++++++?????Forward?????+++++++++++++++++
%---------------????Initialization????---------------
ALPHA(:)=0;?ALPHA=repmat(PAI1D).*P; %Equation?(13)
r=(B(:O(1))‘*sum(ALPHA2)); %Equation?(3)
bmx(:1)=B(:O(1))./r; %Equation?(2)
E(:)=0
評論
共有 條評論