Data Science Asked by mohammad RaoofNia on May 23, 2021
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.
Correct answer by mohammad RaoofNia on May 23, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP