Skip to content

Hidden Markov Models (Gaussian emissions) in Python 3 using Tensorflow (forward-backward and expectation-maximization algorithms)

Notifications You must be signed in to change notification settings

akpradhn-zz/tf_hmm

Repository files navigation

# imports
from tf_hmm import HiddenMarkovModel
from toy_dataset import toy_dataset
import tensorflow as tf
import time
%matplotlib inline 
dataset = toy_dataset(1000,32)
hmm = HiddenMarkovModel(2,2,reports=True)
hmm.expectation_maximization(dataset,max_steps=1000)
the computation graph has been recreated in 2.5 sec
the training process has been converged in 13 steps in 2.4 sec
hmm.plot()

png

hmm.mu
array([[ 1.80040165, -2.15167103],
       [-1.29833214,  1.11217551]])
hmm.cov
array([[[ 1.6233517 , -0.14151129],
        [-0.14151129,  1.07758101]],

       [[ 2.29823099,  0.32517588],
        [ 0.32517588,  1.28161531]]])
hmm.p0
array([ 0.15488769,  0.84511231])
hmm.tp
array([[ 0.52553154,  0.47446846],
       [ 0.19438977,  0.80561023]])

About

Hidden Markov Models (Gaussian emissions) in Python 3 using Tensorflow (forward-backward and expectation-maximization algorithms)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published