Skip to content

Provide initGrid with 1 row #38

@juliuskittler

Description

@juliuskittler

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
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions