Created
August 31, 2017 05:46
-
-
Save kangeugine/b750e11aa266c5bf900e920d73c8a75b to your computer and use it in GitHub Desktop.
HMM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
states = ('Rainy', 'Sunny') | |
observations = ('walk', 'shop', 'clean') | |
start_probability = {'Rainy': 0.6, 'Sunny': 0.4} | |
transition_probability = { | |
'Rainy' : {'Rainy': 0.7, 'Sunny': 0.3}, | |
'Sunny' : {'Rainy': 0.4, 'Sunny': 0.6}, | |
} | |
emission_probability = { | |
'Rainy' : {'walk': 0.1, 'shop': 0.4, 'clean': 0.5}, | |
'Sunny' : {'walk': 0.6, 'shop': 0.3, 'clean': 0.1}, | |
} | |
from hmmlearn import hmm | |
import numpy as np | |
model = MultinomialHMM(n_components=2) | |
model.startprob_ = np.array([0.6, 0.4]) | |
model.transmat_ = np.array([[0.7, 0.3], | |
[0.4, 0.6]]) | |
model.emissionprob_ = np.array([[0.1, 0.4, 0.5], | |
[0.6, 0.3, 0.1]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment