numpyhmmlearn

Numpy error in hmmlearn


I am using hmmlearn library to create HMM. While running the code it gave an error ttributeError: 'module' object has no attribute 'broadcast_to'.

I am running GMMHMM as

model1 = GMMHMM(n_components=4, n_mix=64, covariance_type='diag', n_iter=1000, min_covar=0.001, startprob_prior=1.0, transmat_prior=1.0, weights_prior=1.0, means_prior=0.0, means_weight=0.0, covars_prior=None, covars_weight=None, algorithm='viterbi', random_state=None, tol=0.01, verbose=False, params='stmcw', init_params='stmcw').fit(X)

and the error traceback is

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.linux-i686/egg/hmmlearn/base.py", line 424, in fit
File "build/bdist.linux-i686/egg/hmmlearn/hmm.py", line 609, in _init
File "build/bdist.linux-i686/egg/hmmlearn/hmm.py", line 677, in  
_fix_priors_shape
AttributeError: 'module' object has no attribute 'broadcast_to'

I figured out that it is because of numpy. How can we fix this


Solution

  • Make sure you have at least NumPy 1.10.0, because np.broadcast_to is not available for newer versions.