rpredictionhidden-markov-modelsviterbiactivity-recognition

What does probabilities estimated at the boundary mean? Hidden Markov Models in R using depmixS4 package


I am new to Hidden Markov Models and I am currently trying to use continuous HMM to predict 6 activities on the UCI Human Activity Recognition data set (composed of accelerometer and gyroscope values) in R. I have both train data and test data, and there are 561 features all-in-all. Having read it on several papers, I made a single 6-state HMM and trained it using the train data I have, assuming that the states represent one activity to be classified. After which, I used the viterbi to predict the most likely sequence of the HMM when applied to test data. Using the depmixS4 package for HMMs, I tried to enter these codes:

hmm <- depmix(activity~1,nstates=6,data=train[,-562],family=multinomial("identity"))
fhmm <- fit(hmm)
hmm2 <- depmix(activity~1,nstates=6,data=test[,-562],family=multinomial("identity"))
hmm2 <- setpars(hmm2, getpars(fhmm))
viterbi(hmm2)

I was astonished to see that these codes produced 100% accuracy when all 561 features were used (I only got around 80% accuracy using Jahmm, but then I couldn't used all 561 features on it because it hangs). I am actually in contact with the developer of depmixS4, and he confirmed that the code is okay, but also said, "Note that the fitted model below is in fact an observed or ordinary Markov model and not a hidden Markov model because all the response probabilities are estimated at the boundary." What does he mean by "response probabilities are estimated at the boundary"? I tried searching what it means on the net but to no luck.

And wouldn't using the viterbi mean that it is indeed a Hidden Markov Model? Am I doing it wrong?

Please note that the "viterbi()" function is still an unpublished function on the package (the developer kindly told me about it to be able to try what I have in mind).


Solution

  • In Markov Models, there is a one on one correspondence between states and the observed sequence. In Hidden Markov Models there is no correspondence. Also, there is a hidden state or states: you can't tell the state of the system by looking the correspondent sequence.

    Viterbi is used to find the most probable sequence of a state in HMM. I'm not sure why the author of the package is using Viterbi, maybe he just want to show that Viterbi can be used in observable states.