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.

- Retrieving expected data.frame for testthat expectation
- How to use an anonymous function with pipe operator?
- R passing RSelenium driver environment as function argument
- Keep file names merging list with lapply?
- replace strings that contains one another
- Stop parsing out zeros after decimals in ggplot2's annotate
- Plot data.tree coloring and labelling by level
- Extracting the date and time out of a date and time format
- How to reshape a dataframe into wide format with specified column pairs
- Show partial segments removed after limit scales for `geom_pointrange`
- Control ggplot2 legend look without affecting the plot
- Concatenate strings over all rows in a single column of a data frame
- Is there some way to keep variable names from.SD+.SDcols together with non .SD variable names in data.table?
- How to create mutually dependent checkbox columns in a DT table?
- A problem with an stacked, grouped and faceted graph y gg plot
- Installing R on Linux: configure: error: libcurl >= 7.28.0 library and headers are required with support for https
- Create a column conditional on multiple other character and numerical columns
- data.frame to array (2 columns)
- Changing options() in a function environment without changing options() in global environment in R?
- pivot(), group_by() and summarise() with nested data
- Why legend is not showing up in plot layout using patchwork in R?
- in dplyr::mutate, dplyr::starts_with works for .before but not .after?
- Finding optimal cut-off points for dividing a variable into equal groups considering ties in which quantiles do not work
- How to add a legend to hline?
- R Shiny Suppress slider handle for sliderInput until click
- brmultinom brglm2 vifs and dredge dont work
- R, how to get current time miliseconds, without extra information ? (Sys.time(), format("%X"))
- Installing multiple versions of R
- Command to see 'R' path that RStudio is using
- Fast pairwise longest common substring from start