yanyachen / rBayesianOptimization

Bayesian Optimization of Hyperparameters
81 stars 21 forks source link

Error: Non-finite value supplied by optim #29

Open kojima-albert opened 6 years ago

kojima-albert commented 6 years ago

The rBayesianOptimization sometimes generates an error Non-finite value supplied by optim during the iteration. The numbers of round in which I get this error are different every time. Below is my code.

func <- function(x, y){
  return(list(Score = - x ^ 2 + cos(10 * x) - y ^ 2 + cos(10 * y), Pred = 0))
}

library(rBayesianOptimization)

opt <- BayesianOptimization(
  func
  , bounds = list(x = c(-1.0, 1.0),
                  y = c(-1.0, 1.0))
  , init_points = 5
  , n_iter = 100
  , kappa = 2.576
  , eps = 0.0
  , acq = "ei"
  , verbose = TRUE
)

Is there a way to avoid this error and make rBayesianOptimization finish the iteration?

jasonhearn commented 6 years ago

I am also having this problem and thus, I am wondering if this issue was resolved. I have assured that the input matrix is full rank, as I thought this may be the cause of the problem.

I love the package and would really appreciate support on this issue.

yatzy commented 6 years ago

Same situation as with jasonhearn. Can not figure out the reason.

jmzeng commented 6 years ago

I am hitting the same issue. Would love some help on this!

I did some digging around in the code. For me, the error was thrown when I run the optim_result <- optim(...) function in Utility_Max. I suspect it might be hitting an unstable minimum for me. Do you have suggestions on how to resolve this?

I'm considering changing the control = list(maxit = 100, factr = 5e11) parameter. However, what would be a reasonable range for this for GP optimization?

Thanks!!

semenoffalex commented 5 years ago

Got the same issue today. I'd really appreciate if it were fixed.

jlandman commented 5 years ago

I'm also getting this issue.

TheXu commented 4 years ago

I had the same error.

What worked for me was to change the acquisition function from Expected improvement to GP lower confidence bound.

csetzkorn commented 2 years ago

changing acquisition function to acq = "ucb" solved this for me too.