我python 2.7
在 Windows 10 上的 Anaconda 64 位上运行来自 Matlab 的代码(包含 GPy 和 GPyOpt、高斯过程的 python 实现和贝叶斯优化),我面临以下错误:
固定中的警告:无法导入 cython 模块:使用固定>_gradients_X_cython 回退到 numpy 错误(第 323 行) Python 错误:NameError:未定义全局名称“stationary_cython”
当我在 python 中运行代码时,我没有任何问题,但是当我从 MATLAB 调用脚本时问题就来了(几个月前我已经从 MATLAB 运行了代码,没有任何问题。)
不得不提一下,最近因为某些原因,我把numpy降级到了Numpy=1.11.0。那是因为 Matlab 有一个最新版本的 Numpy 的错误。
我也面临以下窗口: 应用程序已尝试加载 C 运行时库...
问:你能帮我解决这个问题吗?
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)