I'm having trouble implementing a HMM model. I'm starting with a pandas dataframe where I want to use two columns to predict the hidden state. I'm using the hmmlearn package.
I'm following the instructions for hmmlearn 'Working with multiple sequences" https://hmmlearn.readthedocs.io/en/latest/tutorial.html#multiple-sequences
I followed the code below but set X1 and X2 as my columns
X1 = [[0.5], [1.0], [-1.0], [0.42], [0.24]]
X2 = [[2.4], [4.2], [0.5], [-0.24], [0.24]]
X = np.concatenate([X1, X2])
lengths = [len(X1), len(X2)]
hmm.GaussianHMM(n_components=3).fit(X, lengths)
predictions=model.predict(X)
The problem is that when I try to predict the state instead of combining the sequences to create 1 prediction, i'm getting a prediction for each observations. So in this example I want 5 observations but I'm getting 10. Is there a way to incorporate the features of a dataframe as independent variables to get 1 combined prediction?