Problem in working with hmmviterbi() function

4 views (last 30 days)
Debanjan
Debanjan on 22 May 2021
I wanted to implement a Hidden Markov Model (HMM) in Matlab and then use the Viterbi decoding algorithm for finding the best path from the states. Accordingly, I have initially estimated the states, transition probability (TP) and emmission probability (EP). There are a total of 10 states which are labeled as:
states = [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1].
The TP has been estimated as a 10X10 matrix (since there are 10 states) as:
The EP has been estimated as a 10X2 matrix (since there are two emission symbols '0' and '1'):
Now I want to estimate the best path (sequence of states) for a test data. The data is a binary vector of size 1X15 as
seq = [0 1 1 0 0 1 1 0 0 0 0 1 0 1 1].
Accordingly, I have used the function:
estimatedState = hmmviterbi(seq,TP,EP,'Symbols',[0 1],'Statenames',states);
However, the output which I get is only a sequence of the state '0.1'.
estimatedState = [0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1]
I am very much confused with this output since there seems some error in it. In fact, this pattern is repeated for input test data of any length. I want to humbly query if there is some misunderstading of the HMM concepts from my side, or there is some logical error in this code snippet.
Any sort of assistance would be very much appreciated. Thanks in advance.

Answers (0)

Community Treasure Hunt

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

Start Hunting!