Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 this issue Aug 31, 2020 · 2 comments

Comments

@ruchika-67
Copy link

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
Copy link
Author

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants