我正在Windows 10上的Anaconda 64位上运行Matlab的python 2.7
代码(包含GPy和GPyOpt,高斯过程和贝叶斯优化的Python实现),我遇到了以下错误:
静止警告:无法导入cython模块:使用stationary>_gradients_X_cython时出错(第323行)Python错误:Name错误:全局名称'stationary_cython'未定义
当我在python中运行代码时,我没有任何问题,但是当我从MATLAB中调用脚本时,问题就来了(我几个月前从MATLAB中运行代码没有任何问题。
我不得不提,最近由于某些原因,我将numpy降级为Numpy=1.11.0。这是因为Matlab在最新版本的Numpy中有一个bug。
我还面临着以下窗口:应用程序试图加载C运行时库...
**Q:**请问您能帮我解决这个问题吗?
Python Error: NameError: global name 'stationary_cython' is not defined
Error in stationary>gradients_X (line 236)
return self._gradients_X_cython(dL_dK, X, X2)
Error in kernel_slice_operations>wrap (line 118)
ret = s.handle_return_array(f(self, dL_dK, s.X, s.X2))
Error in prod>gradients_X (line 80)
target += self.parts[0].gradients_X(dL_dK*self.parts[1].K(X,
X2), X, X2)
Error in kernel_slice_operations>wrap (line 118)
ret = s.handle_return_array(f(self, dL_dK, s.X, s.X2))
Error in gp>predictive_gradients (line 337)
mean_jac[:,:,i] =
kern.gradients_X(self.posterior.woodbury_vector[:,i:i+1].T, Xnew,
self._predictive_variable)
Error in gpmodel>predict_withGradients (line 113)
dmdx, dvdx = self.model.predictive_gradients(X)
Error in EI>_compute_acq_withGradients (line 47)
m, s, dmdx, dsdx = self.model.predict_withGradients(x)
Error in base>acquisition_function_withGradients (line 46)
f_acqu,df_acqu = self._compute_acq_withGradients(x)
Error in LP>d_acquisition_function (line 128)
_, grad_acq_x = self.acq.acquisition_function_withGradients(x)
Error in LP>acquisition_function_withGradients (line 139)
aqu_x_grad = self.d_acquisition_function(x)
Error in acquisition_optimizer>fp_dfp (line 165)
fp_xx , dfp_xx = f_df(xx)
Error in optimizer>_f_df (line 60)
return f(x), f_df(x)[1][0]
Error in optimize>__call__ (line 63)
fg = self.fun(x, *args)
Error in optimize>function_wrapper (line 289)
return function(*(wrapper_args + args))
Error in lbfgsb>func_and_grad (line 278)
f = fun(x, *args)
Error in lbfgsb>_minimize_lbfgsb (line 330)
f, g = func_and_grad(x)
Error in lbfgsb>fmin_l_bfgs_b (line 193)
**opts)
Error in optimizer>optimize (line 64)
res = scipy.optimize.fmin_l_bfgs_b(_f_df, x0=x0, bounds=self.space.get_bounds(), maxiter=self.maxiter)
Error in acquisition_optimizer>optimize (line 177)
x_min, f_min = self.optimizer.optimize(x0, f =fp, df=None, f_df=fp_dfp)
Error in base>optimize (line 59)
out = self.optimizer.optimize(f=self.acquisition_function, f_df=self.acquisition_function_withGradients)[0]
Error in batch_local_penalization>compute_batch (line 34)
X_batch = self.acquisition.optimize()
Error in bo>_compute_next_evaluations (line 186)
return self.evaluator.compute_batch()
Error in bo>run_optimization (line 108)
self.suggested_sample = self._compute_next_evaluations()
Error in bayesian_optimization>run_optimization (line 458)
super(BayesianOptimization, self).run_optimization(max_iter = max_iter, max_time = max_time, eps = eps,
verbosity=verbosity, save_models_parameters = save_models_parameters, report_file = report_file, evaluations_file=
evaluations_file, models_file=models_file)
Error in bayesian_optimization>__init__ (line 244)
self.run_optimization(max_iter=0,verbosity=self.verbosity)
Error in BatchBO>BAYESOPT2 (line 37)
acquisition_weight = 2)
1条答案
按热度按时间c9qzyr3d1#
你是先安装
paramz
的吗?或者你试过在Anaconda中安装gcc
和gmp
吗?如果你的问题在使用线性内核时消失了,那么依赖性问题似乎是由于Python包管理器Anaconda而出现的。
来源:https://github.com/SheffieldML/GPy/issues/458