I have implemented a HMM using hmmlearn:

states = ['healthy','sick']
observations = ['sleeping','eating','pooping']
model = HMM(n_components=2)
model.n_features = 3
model.startprob_ = [0.7, 0.3]
model.transmat_ = [
    [0.8, 0.2],
    [0.4, 0.6]
model.emissionprob_ = [
    [0.2, 0.6, 0.2],
    [0.4, 0.1, 0.5],

Also, I have a sequence of observations:

obs = np.array([0,0,1,0,2,0,1,2,0,1,0,2,0,1,1,2,0])
obs = obs.reshape(-1, 1)

Now, I would like to predict the next observation (at t+1), but don't know how to do this.

(I've read the documentation but haven't found anything)


i found out that there is no function to do this just can use model.predict() to get hidden states probabilities and then find out the next state(and observation) using Viterbi algorithm.

  • $\begingroup$ If you have answered your own question, please mark your answer as accepted. To do this, you can click the checkmark underneath the vote buttons on your own answer. $\endgroup$ Sep 24 '20 at 3:30

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.