17

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?

nkint
  • 768
  • 3
  • 9
  • 20

6 Answers6

15

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

Gael Varoquaux
  • 865
  • 1
  • 8
  • 12
3

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.

Piotr Migdal
  • 5,586
  • 2
  • 26
  • 70
3

Have you seen NLTK?

http://www.nltk.org/

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

http://www.nltk.org/api/nltk.tag.html#nltk.tag.hmm.HiddenMarkovModelTrainer

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

http://pastebin.com/aJG3Ukmn

KT12
  • 203
  • 2
  • 9
qi5d02lx
  • 221
  • 2
  • 4
  • 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: http://www.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
  • 1
    alright, how about this: http://www.creativedistraction.com/demos/gesture-recognition-kinect-with-hidden-markov-models-hmms/ 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: http://code.google.com/p/ehci/ – qi5d02lx Jan 19 '12 at 23:40
1

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

Remi
  • 11
  • 1
1

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

nairboon
  • 161
  • 1
  • 3
0

Following is a Pyhton implementation of Baum-Welch Algorithm:

https://github.com/hamzarawal/HMM-Baum-Welch-Algorithm