How to Train HMM model with two different sequences using the Baum-Wech algorithm I am using HMM to visualize drinking gestures of different container types.
I began training HMM with one sequence corresponding to one container type, but I want to visualize it with python now with different container types.
How can I map different sequences in one model?
For the training data do I have to insert them as one sequence (of different container types)?
 A: I am missing some information about your problem for a complete answer, but assuming that you have a finite number of known containers that can be used and that this number is not too big, here is what I would suggest you to start with.


*

*Gather multiple training sequences for each type of container

*Train one HMM for each type of container. Depending of the nature of your sequences samples (discrete? continuous values?) use either discrete emission probabilities or Gaussian ones. If your sequences always start from the "same moment" in the action of drinking, using a left-to-right topology could be appropriate (for this, you often just need to initialize the transition matrix as an upper-triangular matrix). With Python, there is the hmmlearn library that provides you with the functions needed to train an HMM in all the aforementioned cases (discrete, Gaussian, left-to-right). Here's the doc. (The documentation also explains how to handle multiple training samples.)

*Once you have a trained HMM for each type of container, a new sequence can be classified by computing its likelihood with respect to each HMM. The highest this value is, the more probable the sequence belongs to this class. This likelihood can be computed using a forward algorithm which is very simply described in this paper as the "Solution to the first Problem" (on page 5). (In case the link dies one day the paper is: An introduction to hidden Markov models, by Rabiner and Juang, in ASSP Magazine (1986))
From your comment I feel that you misunderstood how to use multiple sequences in HMMs training. The idea is not to train or re-train the model for each sequence! The training procedure is only done once. Using multiple sequences for this training will avoid overfitting and make the model more robust to the natural variation data from a same class have. From my personal experience, all libraries implementing HMMs allow to pass multiple sequences for training.
