我在Windows 10上的Anaconda 64bit的Matlab上运行python 2.7
代码(包含GPy和GPyOpt,高斯过程和贝叶斯优化的python实现),我面临以下错误:
静止警告:未能导入cython模块:回退到 使用固定> _gradients_X_cython(第323行)Python的numpy错误 错误: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)
答案 0 :(得分:0)
您是否先安装了var y = document.getElementById('parent');
y.childNodes[0].removeChild(y.childNodes[0].childNodes[2]);
<div id="parent">
<div>
<a href="#">First</a>
<a href="#">second</a>
<a href="#">third</a> <!--I wanna delete this-->
</div>
</div>
?
还是您尝试在Anaconda中安装paramz
和gcc
?
如果使用线性内核时问题消失了,则似乎是由于Python Package Manager Anaconda引起了依赖问题。