📄 demlike.m
字号:
% A demonstration of the HMM software using the 'Likelihood' observation% model. There are K=2 time series where EACH TIME SERIES IS THE % LIKELIHOOD OF THE DATA GIVEN THAT STATE - in effect there is % no observation model; the likelihood of each data point is simply% set to the value of each data point.clearload demlikefigureplot(pp_t(:,1));title('Original data - series 1');disp('The plot shows the likelihood of data given state/class 1');disp(' ');disp('Press a key to train up an HMM');disp(' ');pauseXseries=pp_t;hmm=struct('K',2);disp(' ');% I don't initialise, I have to do it manuallyhmm.obsmodel='LIKE';hmm.train.obsupdate=0;hmm.train.init=1; % We've already initialisedhmm.priors=struct('Dir2d_alpha',ones(hmm.K),'Dir_alpha',ones(1,hmm.K));T=size(Xseries,1);% Train HMMhmm=hmmtrain(Xseries,T,hmm);[block,LL]=hmmdecode(Xseries,T,hmm); % Find most likely hidden state sequence using Viterbi methodfigureplot(block(1).q_star);axis([0 800 0 3]);title('Viterbi decoding');disp('State transition matrix is:');hmm.Pdisp('The Viterbi decoding plot shows that the time series');disp('has been correctly partitioned.');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -