Coder Social home page Coder Social logo

hiddenmarkovmodel_tensorflow's Introduction

Hidden Markov Model in TensorFlow

##Jupyter Notebook: Check out the Notebook for Examples.

Viterbi Algorithm

  • Efficient way of finding the most likely state sequence.
  • Method is general statistical framework of compound decision theory.
  • Maximizes a posteriori probability recursively.
  • Assumed to have a finite-state discrete-time Markov process.

Forward-Backward Algorithm

  • The goal of the forward-backward algorithm is to find the conditional distribution over hidden states given the data.
  • It is used to find the most likely state for any point in time.
  • It cannot, however, be used to find the most likely sequence of states (see Viterbi)

Baum Welch Algorithm

  • Expectation Maximization Inference of unknown parameters of a Hidden Markov Model.

Viterbi

Unrolled graph

Belief Propagation

Backtrack

Baum Welch and Forward-Backward

Forward-Backward

Re-estimate

Unrolled

hiddenmarkovmodel_tensorflow's People

Contributors

aseipel avatar marvinbertin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hiddenmarkovmodel_tensorflow's Issues

ExpandDims dim value error

My problem is that I give observation sequence 3~5 states, the program can run, but when I give observation sequence 2 states, it raised some errors.

Below is error,

ValueError: dim 1 not in the interval [-1, 0]. for 'Train_Baum_Welch/EM_step-0/Re_estimate_transition/Smooth_gamma/ExpandDims' (op: 'ExpandDims') with input shapes: [], [] and with computed input tensors: input[1] = <1>.

Is it caused by the tensor dimension? Could you please help me to solve the issue? Appreciate for your help.

Warm regards,
Jacky

running forward backward AttributeError

It seems in running forward backward algorithm there are errors:

`AttributeError Traceback (most recent call last)
in ()
2 model = HiddenMarkovModel_FB(trans, emi, p0)
3
----> 4 results = model.run_forward_backward(obs_seq)
5 result_list = ["Forward", "Backward", "Posterior"]
6

/Users/xxx/Desktop/hmm/forward_bakward.pyc in run_forward_backward(self, obs_seq)
207 with tf.Session() as sess:
208
--> 209 forward, backward, posterior = self.forward_backward(obs_seq)
210 sess.run(tf.initialize_all_variables())
211 return sess.run([forward, backward, posterior])

/Users/xxx/Desktop/hmm/forward_bakward.pyc in forward_backward(self, obs_seq)
188
189 # forward belief propagation
--> 190 self._forward(obs_prob_seq)
191
192 # backward belief propagation

/Users/xxx/Desktop/hmm/forward_bakward.pyc in _forward(self, obs_prob_seq)
119 prior_prob = tf.matmul(prev_prob, self.T)
120 # forward belief propagation
--> 121 forward_score = tf.mul(prior_prob, tf.cast(obs_prob_seq[step, :], tf.float64))
122 # Normalize score into a probability
123 forward_prob = tf.reshape(forward_score / tf.reduce_sum(forward_score), [-1])

AttributeError: 'module' object has no attribute 'mul'`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.