carlosandrepaes / GaPP

Gaussian Processes GaPP code auxiliary repository
17 stars 11 forks source link

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() #1

Open ruchika-67 opened 4 years ago

ruchika-67 commented 4 years ago

Whenever I am trying to run any code from examples or H0_measurement.py , I am getting this error.

"Traceback (most recent call last): File "gp_example.py", line 28, in g = gp.GaussianProcess(X, Y, Sigma, cXstar=(xmin, xmax, nstar)) File "/usr/local/lib/python2.7/dist-packages/gapp/gp.py", line 117, in init if (xmin == None or xmax == None): ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() "

Please let me know how can I debug program in my setup. Thanks a lot in advance!

ruchika-67 commented 4 years ago

When running H0_measurement.py

Traceback (most recent call last): File "H0_measurement.py", line 35, in (rec1,theta1) = g1.gp(thetatrain='True') File "/usr/local/lib/python2.7/dist-packages/gapp/gp.py", line 847, in gp return(self.fgp(unpack=unpack)) File "/usr/local/lib/python2.7/dist-packages/gapp/gp.py", line 853, in fgp self.hypertrain() File "/usr/local/lib/python2.7/dist-packages/gapp/gp.py", line 610, in hypertrain return(self.fhypertrain()) File "/usr/local/lib/python2.7/dist-packages/gapp/gp.py", line 634, in fhypertrain messages=8)[0] File "/usr/lib/python2.7/dist-packages/scipy/optimize/tnc.py", line 275, in fmin_tnc res = _minimize_tnc(fun, x0, args, jac, bounds, callback=callback, *opts) File "/usr/lib/python2.7/dist-packages/scipy/optimize/tnc.py", line 409, in _minimize_tnc xtol, pgtol, rescale, callback) File "/usr/lib/python2.7/dist-packages/scipy/optimize/tnc.py", line 371, in func_and_grad f = fun(x, args) File "/usr/lib/python2.7/dist-packages/scipy/optimize/optimize.py", line 63, in call fg = self.fun(x, *args) File "/usr/local/lib/python2.7/dist-packages/gapp/gp.py", line 632, in logpfunc return self.grad_nlog_likelihood() File "/usr/local/lib/python2.7/dist-packages/gapp/gp.py", line 514, in grad_nlog_likelihood if (self.alpha == None): ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Ian-Jhon commented 3 years ago

When running H0_measurement.py

Traceback (most recent call last): File "H0_measurement.py", line 35, in (rec1,theta1) = g1.gp(thetatrain='True') File "/usr/local/lib/python2.7/dist-packages/gapp/gp.py", line 847, in gp return(self.fgp(unpack=unpack)) File "/usr/local/lib/python2.7/dist-packages/gapp/gp.py", line 853, in fgp self.hypertrain() File "/usr/local/lib/python2.7/dist-packages/gapp/gp.py", line 610, in hypertrain return(self.fhypertrain()) File "/usr/local/lib/python2.7/dist-packages/gapp/gp.py", line 634, in fhypertrain messages=8)[0] File "/usr/lib/python2.7/dist-packages/scipy/optimize/tnc.py", line 275, in fmin_tnc res = _minimize_tnc(fun, x0, args, jac, bounds, callback=callback, *opts) File "/usr/lib/python2.7/dist-packages/scipy/optimize/tnc.py", line 409, in _minimize_tnc xtol, pgtol, rescale, callback) File "/usr/lib/python2.7/dist-packages/scipy/optimize/tnc.py", line 371, in func_and_grad f = fun(x, args) File "/usr/lib/python2.7/dist-packages/scipy/optimize/optimize.py", line 63, in call fg = self.fun(x, *args) File "/usr/local/lib/python2.7/dist-packages/gapp/gp.py", line 632, in logpfunc return self.grad_nlog_likelihood() File "/usr/local/lib/python2.7/dist-packages/gapp/gp.py", line 514, in grad_nlog_likelihood if (self.alpha == None): ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Please change if (self.alpha == None): to if (self.alpha == None).all(): in gapp/gp.py and gapp/dgp.py