hmmlearn中的Numpy错误

时间:2017-02-04 14:23:44

标签: numpy hmmlearn

我正在使用hmmlearn库来创建HMM。在运行代码时,它给出了错误ttributeError:'module'对象没有属性'broadcast_to'。

我正在运行GMMHMM

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)

并且错误回溯是

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'

我发现这是因为numpy。我们如何解决这个问题

1 个答案:

答案 0 :(得分:1)

确保您至少拥有NumPy 1.10.0,因为np.broadcast_to不适用于较新版本。