I am trying to recognise human activity gestures using hidden Markov model. I have created a dataset such that, when I do a particular gesture 10 observation arrays are generated with time. Each observation sequence has looks like this [timestamp, x_acc, y_acc, z_acc, x_gyro,y_gyro, z_gyro]. Hence my dataset for a particular gesture consists of observations when I do that particular gesture 10 times, thereby making total 100 arrays. I am confused how should I use this dataset to recognise the gesture using Hidden Markov model in python using pomegranate library. Or do I need to make any changes in the dataset for training hmm? I need to know how should be the format of my dataset in order to train hmm with it? I plan to use 1 discrete hmm for 1 gesture.


1 Answer 1


the way you are feeding seems appropriate, if you feel the dataset is getting huge for your problem, you could do a better feature engineering technique.

I have worked on predicting the UCI ML Daily and Sports Activities dataset from where they have five devices like you have and take it operates at 25Hz. So for each second, they have 25 readings from 5 devices. So it was a lot, and I implemented this paper:

K. Altun, B. Barshan, and O. Tunçel, Comparative study on classifying human activities with miniature inertial and magnetic sensors, Pattern Recognition, 43(10):3605-3620, October 2010.

This is the above mentioned paper.

Where they do various feature engineering techniques from mean to DFT peaks etc. I did the same using Python, it's available on github repo.

I used sklearn mostly, and later went with pytorch, but never tried HMM, but you should definitely check out HMM from sklearn.

Try both with feature engineering and without feature engineering, and maybe reduce using PCA.

Hope that helps.

  • $\begingroup$ Thank you for answer. But I wish to keep those many features only and have to use Hmm only . I have heard that I need to do Vector quantization before training discrete hmm with the dataset. Can you tell me how to do it and what form hmm will accept data for it to train? $\endgroup$
    – joji
    Jun 29, 2018 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.