ParBayesianOptimization icon indicating copy to clipboard operation
ParBayesianOptimization copied to clipboard

Provide initGrid with 1 row

Open juliuskittler opened this issue 4 years ago • 0 comments

Problem

It seems that currently, I can't provide an initGrid consisting of a data frame with only 1 row.

The inBounds <- as.logical(apply(inBounds,1,prod)) in https://github.com/AnotherSamWilson/ParBayesianOptimization/blob/master/R/bayesOpt.R will fail if there is just 1 row.

Error

Error in apply(inBounds, 1, prod) : dim(X) must have a positive length

Reproducible Example


library(ParBayesianOptimization)

simpleFunction <- function(x) dnorm(x,3,2)*1.5 + dnorm(x,7,1) + dnorm(x,10,2)
FUN <- function(x) list(Score = simpleFunction(x))

bounds <- list(x=c(0,15))
initGrid <- data.frame(x=c(5))

set.seed(6)
optObjSimp <- bayesOpt(
  FUN = FUN
  , bounds = bounds
  , initGrid = initGrid
  , iters.n = 2
)

juliuskittler avatar Jun 28 '21 13:06 juliuskittler