4

I cant import hmm module from sklearn.

from sklearn import hmm

I get error :

ImportError: cannot import name hmm
aman
  • 1,875
  • 4
  • 18
  • 27
  • Possible duplicate of [ImportError: cannot import name](http://stackoverflow.com/questions/17845366/importerror-cannot-import-name) – ByteWelder Jun 08 '16 at 08:41

2 Answers2

7

I don't know if you found a solution to your problem.

You can install and implement your HMM using hmmlearn.

It can be installed easily with a pip install hmmlearn.

To quote Scikit-learn,

Warning The sklearn.hmm module has now been deprecated due to it no longer matching the scope and the API of the project. It is scheduled for removal in the 0.17 release of the project. This module has been moved to a seperate repository: https://github.com/hmmlearn/hmmlearn

Pragyaditya Das
  • 1,648
  • 6
  • 25
  • 44
  • Hi @Pragyaditya and @ishmaelMakitla I am facing the same error and I did try `pip install hmmlearn ` but i am getting the same error - `ImportError: No module named hmm`. I even updated all the required modules, did you try anything else apart from this? – AnkP Dec 19 '16 at 06:02
  • @AnkP which version of Python are you on? – Pragyaditya Das Dec 25 '16 at 07:28
4

According to the Hidden Markov Models site here, the sklearn.hmm module has been deprecated and is scheduled for removal in the 0.17. Confirm that your scikit-learn is at least version 0.16.1 because from 0.17 you won't have sklearn.hmm.

ishmaelMakitla
  • 3,784
  • 3
  • 26
  • 32