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

Error when running #24

Closed
RemiDav opened this issue Jul 27, 2019 · 1 comment
Closed

Error when running #24

RemiDav opened this issue Jul 27, 2019 · 1 comment

Comments

@RemiDav
Copy link

RemiDav commented Jul 27, 2019

I get the following error randomly when running with ExpectedImprovement acquisition:
gpgo.run(max_iter=32, resume=True)

Error:

C:\ProgramData\Anaconda3\lib\site-packages\pyGPGO\GPGO.py:109: RuntimeWarning: invalid value encountered in sqrt
  new_std = np.sqrt(new_var + 1e-6)
C:\ProgramData\Anaconda3\lib\site-packages\pyGPGO\covfunc.py:51: RuntimeWarning: invalid value encountered in less
  return cdist(X, Xstar) < np.finfo(np.float32).eps
Traceback (most recent call last):
  File "D:\Dropbox\Dev\Python\MultiDDM\TeaLab\run_MultiDDM.py", line 243, in <module>
    gpgo.run(max_iter=explore_schedule[sched], resume=True)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pyGPGO\GPGO.py", line 191, in run
    self._optimizeAcq()
  File "C:\ProgramData\Anaconda3\lib\site-packages\pyGPGO\GPGO.py", line 131, in _optimizeAcq
    bounds=self.parameter_range)
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\optimize\_minimize.py", line 601, in minimize
    callback=callback, **options)
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\optimize\lbfgsb.py", line 335, in _minimize_lbfgsb
    f, g = func_and_grad(x)
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\optimize\lbfgsb.py", line 280, in func_and_grad
    f = fun(x, *args)
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\optimize\optimize.py", line 300, in function_wrapper
    return function(*(wrapper_args + args))
  File "C:\ProgramData\Anaconda3\lib\site-packages\pyGPGO\GPGO.py", line 108, in _acqWrapper
    new_mean, new_var = self.GP.predict(xnew, return_std=True)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pyGPGO\surrogates\GaussianProcess.py", line 222, in predict
    v = solve(self.L, kstar.T)
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\linalg\basic.py", line 140, in solve
    b1 = atleast_1d(_asarray_validated(b, check_finite=check_finite))
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\_lib\_util.py", line 239, in _asarray_validated
    a = toarray(a)
  File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\function_base.py", line 498, in asarray_chkfinite
    "array must not contain infs or NaNs")

I do not know how to reproduce the behavior since it works fine most of the time.

@RemiDav
Copy link
Author

RemiDav commented Jul 27, 2019

I am trying to modify the _acqWrapper function to return the maximum float value if the result of the sqrt is nan. We will see what happens.

def _acqWrapper(self, xnew):
    new_mean, new_var = self.GP.predict(xnew, return_std=True)
    new_std = np.sqrt(new_var + 1e-6)
    if np.isnan(new_std).any():
        return sys.float_info[0]
    else:
        return -self.A.eval(self.tau, new_mean, new_std)

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