How to interpret log probability from hmmdecode?

9 views (last 30 days)
Greetings!
I've entered and run the following code (where it was taken from the hmm matlab tutorial):
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];
[seq,states] = hmmgenerate(100,trans,emis); [pStates,logprob] = hmmdecode(seq,trans,emis);
where the variable logprob (which represents the log probability) is -174.9891.
I am wondering how to interpret this number as an actual probability. When I take its exponential I get 1.0074e-76. Which seems extremely low considering the sample was generated from the model. Is this the correct way to interpret the log probability?

Answers (1)

Chris Perkins
Chris Perkins on 10 Aug 2017
Hi Austin,
That is the correct way of interpreting the probability, which in this instance is almost zero. However, the given probability is the probability that the exact sequence 'seq' was generated. As 'seq' is a 100 element long sequence, there are many different possibilities, so the probability of each individual sequence being generated is extremely small.
If you try running this with a shorter sequence (changing the first input to the function 'hmmgenerate' to a number smaller than 100), you will notice, on average, that 'logprob' gets closer to zero as you decrease the length of the sequence, corresponding to a higher probability.
Try inputting small numbers for the sequence length and see what probability you get.
Also note that if you run this code multiple times, you will get different values for 'logprob', as a different sequence is generated by the 'hmmgenerate' function each time, and each sequence has a different probability of being generated.

Community Treasure Hunt

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

Start Hunting!