-1

我正在使用 hmmlearn 库来创建 HMM。运行代码时出现错误 ttributeError: 'module' object has no attribute '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. 我们如何解决这个问题

4

1 回答 1

1

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

于 2017-02-07T21:35:43.237 回答