yanyachen / rBayesianOptimization

Bayesian Optimization of Hyperparameters
81 stars 21 forks source link

crash after running some iterations #44

Open asheetal opened 2 years ago

asheetal commented 2 years ago

Error in chol.default(x = Sig) : the leading minor of order 52 is not positive definite Calls: BayesianOptimization ... fn -> GP_deviance -> sig_invb -> chol -> chol.default In addition: There were 50 or more warnings (use warnings() to see the first 50) Execution halted

xgb.bayesian.search <- BayesianOptimization(xgb.bayes, # my function
                                            bounds = xgb.bounds,
                                            init_grid_dt = as.data.frame(xgb.initial.grid),
                                            init_points = 0, 
                                            n_iter = 200,
                                            acq = "ucb", 
                                            kappa = 2.576, 
                                            eps = 0.0,
                                            verbose = TRUE)

After running 50 or so iterations I get a crash with this error message. Is running latest version from CRAN. Hope someone can advice how to move past this.

hanibalSC commented 2 years ago

Hi, I've also run into this issue several times now. Not sure how exactly it's caused yet. It also doesn't print the parameters for which the error occurs. However, it looks to me like it happens after BO has tested similar choices for parameters for a couple iterations.

hanibalSC commented 2 years ago

This appears to be an issue with the covariance matrix for the Gaussian process underlying Bayesian optimization. I am not totally clear about how to interpret it, but you might want to give switching kernels a try. By default rBayesianOptimization uses an exponential kernel. You can try if matern works by adding the argument kernel = list(type = "matern", nu = 5/2). It worked in one of my cases.