?? hmmdemo.m
字號:
echo on;clc;% load and plot data on geyser eruption durations and waiting timesload geyser; clf; subplot(211);plot(geyser(:,1),geyser(:,2),'o'); xlabel('dur'); ylabel('wait time');axis('square'); hold on;% Hit any key to continue pause;clc;% divide up datasetXtrain=geyser(1:200,:); Xtest=geyser(201:295,:);% train HMM with 3 states for 30 cycles of EM or until convergence[Mu,Cov,P,Pi,LL]=hmm(Xtrain,200,3,30); % plot log likelihood (log L) per samplesubplot(212);plot(LL/200); ylabel('Log likelihood per sample'); xlabel('Iterations of EM'); hold on;% calculate log L for test datalik=hmm_cl(Xtest,95,3,Mu,Cov,P,Pi); plot(length(LL),lik/95,'go');% examine state transition matrix and plot meansP subplot(211);plot(Mu(:,1),Mu(:,2),'r*');echo off;hold off;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -