Error in FUN(X[[i]], ...) : subscript out of bounds

Hi I am using bayesian optimization to tune the parameter of mtry for random forest but it gives me the error: Error in FUN(X[[i]], ...) : subscript out of bounds

I am using the following code:

fit_bayes <- function(mtry) {

Use the same model code but for a single (C, sigma) pair.

mod <- train(Effort ~ ., data = tr,
method = "rf",
preProc = c("center", "scale", "zv"),
metric = "RMSE",
trControl = ctrl,
tuneGrid = data.frame(C = 10^(mtry)))

list(Score = -getTrainPerf(mod)[, "TrainRMSE"], Pred = 0)
}

library(rBayesianOptimization)

bounds <- list(mtry = c(-2, 5)

set.seed(8606)
bo_search <- BayesianOptimization(fit_bayes,
bounds = bounds,
init_points = 10,
n_iter = 100,
acq = "ucb",
kappa = 1,
eps = 0.0)
bo_search

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.