hmmlearn 中的 Numpy 错误
Numpy error in hmmlearn
我正在使用 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。我们如何解决这个问题
确保您至少拥有 NumPy 1.10.0,因为 np.broadcast_to
不适用于较新的版本。
我正在使用 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。我们如何解决这个问题
确保您至少拥有 NumPy 1.10.0,因为 np.broadcast_to
不适用于较新的版本。