필터 지우기
필터 지우기

hmmtrain.m with unknown state sequence (Baum-Welch)

조회 수: 2 (최근 30일)
Matlab2010
Matlab2010 2012년 10월 18일
답변: amani 2015년 6월 18일
I have a vector of observations Y. I do not know the state sequence of the latents. I wish to find the the transistion and emission matrices hence I want Baum-Welch.
My Min Working example is here:
T = 1000; % Number of timesteps
Y= 1000+cumsum(randn(T,1));
K = 200; %number of states
beta = 0.5;
TRGUESS = get_stateTransitionMatrix(K, beta); %flat start model
N = 2;
EMITGUESS = (1/N) .* ones(K,N);
[TRANS,EMIS] = hmmtrain(Y,TRGUESS,EMITGUESS);
function TRGUESS = get_stateTransitionMatrix(K, beta)
TRGUESS = beta.*eye(K,K);
for i=1:K
for j=1:K
if (TRGUESS(i,j)==0)
TRGUESS(i,j) = (1-beta)/(K-1);
end
end
end
end
On running this I get:
Error using hmmdecode (line 100)
SEQ must consist of integers between 1 and 1.
Error in hmmtrain (line 213)
[~,logPseq,fs,bs,scale] = hmmdecode(seq,guessTR,guessE);
I fear I have misunderstood the hmmtrain documentation. Can anyone help?
thanks!
(using 2012A and all the toolboxes)
  댓글 수: 1
Matlab2010
Matlab2010 2012년 11월 14일
Follow up -- just to be clear, hmmtrain.m supports the discrete case.
if you have Gaussian (or other) emissions, then you need to look elsewhere eg http://code.google.com/p/pmtk3/

댓글을 달려면 로그인하십시오.

채택된 답변

Sean de Wolski
Sean de Wolski 2012년 10월 18일
편집: Sean de Wolski 2012년 10월 18일
Y, your input for seqs (the first input) need to be integers ranging from 1:n that are the discrete values for training.
You can map back to the original values (whatever these integers happen to represent) later.
More
T=1000; % Number of timesteps
Y= 1000+cumsum(randn(T,1));
[uV,~,seqs] = unique(Y); %map unique values to their indices
seqs2 = rem(seqs,24)+1; %redefine as only 25 states
N = 5; %states
M = 25; %24+1
A = ones(N)/N;
B = ones(N,M)/M;
[TRANS,EMIS] = hmmtrain(seqs2',A,B);
  댓글 수: 2
Matlab2010
Matlab2010 2012년 10월 18일
편집: Matlab2010 2012년 11월 14일
ah. thank you! a lot clearer. However, when people say that Baum-Welch is for when you don't know the hidden states, have we not just guessed them here, for the training?
thank you!!
Sean de Wolski
Sean de Wolski 2012년 10월 18일
Guessing means we didn't need to know :)
I don't have time to look into your second question today.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

imene s
imene s 2015년 3월 18일
please i need this fuction hmmtrain
  댓글 수: 1
Sean de Wolski
Sean de Wolski 2015년 3월 19일
It's in the Statistics Toolbox which you or your company/university will need to purchase.

댓글을 달려면 로그인하십시오.


amani
amani 2015년 6월 18일
Any thoughts about the default prior vector (pi) used in hmmtrain.m ??

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by