1. 定義transition probability和 emis probability .

trans = [0.95,0.05 ;
0.10,0.90 ] ;

emis = [1/6 1/6 1/6 1/6 1/6 1/6;
1/10 1/10 1/10 1/10 1/10 1/2 ];
2. 用定義好的probability隨機產生一個sequence.
seq 存的是在第 i 步時的symbol,
states 存的是在第 i 步時所在的 state.
[seq,states] = hmmgenerate( 8,trans,emis);
result :

3. 可對symbols 及 states 另取名稱 .
[seq,states] = hmmgenerate( 8 ,trans,emis,...
'Symbols',{'one','two','three','four','five','six'},...
'Statenames',{'fair';'loaded'})
result :

==用已知的sequence, states反推出 trans 和 emis 機率==
1. 用此matlab指令
[estimateTR,estimateE] = hmmestimate(seq,states);
result :


=======pStates========
trans, emis, seq同上,輸入matlab指令.
PSTATES = hmmdecode(seq,TRANS,EMIS);
result :

沒有留言:
張貼留言