yanyachen / rBayesianOptimization

Bayesian Optimization of Hyperparameters
81 stars 21 forks source link

rBayesianOptimization on gaussion process regression #40

Open DrZhaoJie opened 3 years ago

DrZhaoJie commented 3 years ago

Hi, I really enjoy your code and try to implement it on the gaussian process regression based on kernlab package. Here is my code

`x <- scale(iris[,c(1:3)]) y <- iris[,4]

library(kernlab) gausspr6_bayes <- function(sigma) { gausspr6 <-gausspr(x, y, scaled = TRUE, type= "regression", kernel="rbfdot", kpar = list(sigma=sigma), cross=5) list(ypred=predict(gausspr6,x)) }

library(rBayesianOptimization) OPT_Res <-BayesianOptimization(gausspr6_bayes, bounds =list(sigma = c(0, 6)), init_grid_dt =NULL,init_points = 10, n_iter = 20, acq ="ucb", kappa = 2.576, eps = 0.0, verbose = TRUE)`

it runned with the following errors: Error in data.table::set(DT_history, i = as.integer(i), j = "Value", value = as.list(c(This_Score_Pred$Score))) : RHS of assignment to existing column 'Value' is zero length but not NULL. If you intend to delete the column use NULL. Otherwise, the RHS must have length > 0; e.g., NAinteger. If you are trying to change the column type to be an empty list column then, as with all column type changes, provide a full length RHS vector such as vector('list',nrow(DT)); i.e., 'plonk' in the new column.

How can I deal with it? Thank you very much!

tinghua-chen commented 3 months ago

I have the same error by running hyperparameter turning for GP kernel. Does anyone know how to solve this?