# Hidden Markov models with Baum-Welch algorithm using python

I'm looking for some python implementation (in pure python or wrapping existing stuffs) of HMM and Baum-Welch.

Some ideas?

I've just searched in google and I've found really poor material with respect to other machine learning techniques. Why?

-

The scikit-learn has an HMM implementation. It was until recently considered as unmaintained and its usage was discouraged. However it has improved in the development version. I cannot vouch for its quality, though, as I know nothing of HMMs.

Disclaimer: I am a scikit-learn developer.

Edit: we have moved the HMMs outside of scikit-learn, to https://github.com/hmmlearn/hmmlearn

-
yeah i decide to don't use it because of unmantainement.. – nkint Mar 11 '12 at 18:29
I think that it is improving and that we will soon be able to commit to maintaining it. – Gael Varoquaux Mar 11 '12 at 19:03
does the sklearn implementation use Baum-Welch? – Vishal Sep 24 '12 at 13:03
Yes it does. See _BaseHMM documentation for implementation details. – Sergei Lebedev Mar 1 at 11:04

Have you seen NLTK?

It has some classes that are suitable for this sort of thing, but somewhat application dependent.

If you are looking for something more 'education oriented', I wrote toy trainer a while ago:

http://pastebin.com/aJG3Ukmn

-
thanks. i need it for gesture recognition. i'm stucked on what could be my alphabet (symbols in nltk) in my application.. – nkint Jan 19 '12 at 11:40
@nkint Check this out: ri.cmu.edu/pub_files/pub3/yang_jie_1994_1/yang_jie_1994_1.pdf – qi5d02lx Jan 19 '12 at 11:47
ok the data are the labels so if i use only 8 labels for clusterize the coordinates of a gesture.. alphabet is [1,2,3,4,5,6,7] – nkint Jan 19 '12 at 17:16
but still don't understand the difference between state and symbol in HiddenMarkovModelTrainer constructor – nkint Jan 19 '12 at 18:15
alright, how about this: creativedistraction.com/demos/… it's a step-by-step demo with code of how to build your own gesture recognizer with the kinect. code is for Octave not python, but it seems like you are stuck on the ideas/implementation more than the particulars of the software. of course it requires a kinect... you might also check this out: code.google.com/p/ehci – qi5d02lx Jan 19 '12 at 23:40

Some implementation of basic algorithms (including Baum-welch in python) are available here: http://ai.cs.umbc.edu/icgi2012/challenge/Pautomac/baseline.php

-

The General Hidden Markov Model library has python bindings and uses the Baum-Welch algorithm.

-

You can find Python implementations on:

BTW: See Example of implementation of Baum-Welch on Stack Overflow - the answer turns out to be in Python.

-