Giter Site home page Giter Site logo

geeky-bit / tensorflow-hiddenmarkovmodel-baum_welch-viterbi-forward_backward-algo Goto Github PK

View Code? Open in Web Editor NEW
16.0 1.0 4.0 2.25 MB

Python 15.52% Jupyter Notebook 84.48%
tensorflow baum-welch-algorithm viterbi-algorithm forward-backward-algo hidden-markov-model

tensorflow-hiddenmarkovmodel-baum_welch-viterbi-forward_backward-algo's Introduction

Note :: Most of the functions used are adapted from some other github repos and some online materials.

Hidden Markov Model using Tensorflow

Jupyter Notebooks:

These are some of the examples that I have included in the jupyter notebook. Feel free to add more.

Baum Welch Algorithm

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

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)

Differences ::

The Baum-Welch algorithm and the Viterbi algorithm calculate different things.

Use Viterbi : The Viterbi training algorithm (as opposed to the "Viterbi algorithm") approximates the MLE to achieve a gain in speed at the cost of accuracy

  • known : transition probabilities for the hidden part of your model
  • known : emission probabilities for the visible outputs of your model
  • Gives : the most likely complete sequence of hidden states conditional on both your outputs and your model specification.

Use Baum-Welch : The Baum-Welch algorithm is essentially the Expectation-Maximization algorithm applied to a HMM

Gives :

  • The most likely hidden transition probabilities

  • The most likely set of emission probabilities given only the observed states of the model (and, usually, an upper bound on the number of hidden states)

Tip : If you know your model and just want the latent states, then there is no reason to use the Baum-Welch algorithm. If you don't know your model, then you can't be using the Viterbi algorithm.

Note : The codes are freely available. Please feel free to add more codes. Spread the word!

tensorflow-hiddenmarkovmodel-baum_welch-viterbi-forward_backward-algo's People

Contributors

geeky-bit avatar

Stargazers

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

Watchers

 avatar

tensorflow-hiddenmarkovmodel-baum_welch-viterbi-forward_backward-algo'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

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.