I have two training sets (observations of known class) representing the two possible states in my data. I would like to have hmmlearn estimate the start, transition, and emission probabilities from these two training sets.
My data is a list of values between 0-1. I have already split the data into to coarse groups 'A' and 'B' using a conservative threshold. I want to use an HMM to refine the points at which my data changes state.
For a single train/test sequence X I would do this:
X = [0, 1, 1, 1, 0.1, 0.015, 0.01, 0.001, 0.005, 0.001, 0.2, 1, 0.8, 1, 1, 0.3]
states = ["A", "B"]
#Fit model, auto set probabilities
model = hmm.MultinomialHMM(n_components=2, covariance_type="full")
model.fit([X])
#Predict states
Z = model.predict(X)
#Predict a sequence of hidden states based on visible states
logprob, state = model.decode(X, algorithm="viterbi")
print "States:", ", ".join(map(lambda x: states[x], state))
>>> States: A, B, B, B, B, A, A, A, A, A, B, B, B, B, B, B
I would like to know how to train state A and state B separately.