Skip to contents

Returns all local optimums of the acquisition function, no matter the utility.

Usage

getLocalOptimums(
  optObj,
  bounds = optObj$bounds,
  acq = optObj$optPars$acq,
  kappa = optObj$optPars$kappa,
  eps = optObj$optPars$eps,
  convThresh = optObj$optPars$convThresh,
  gsPoints = optObj$optPars$gsPoints,
  parallel = FALSE,
  verbose = 1
)

Arguments

optObj

an object of class bayesOpt. The following parameters are all defaulted to the options provided in this object, but can be manually specified.

bounds

Same as in bayesOpt()

acq

Same as in bayesOpt()

kappa

Same as in bayesOpt()

eps

Same as in bayesOpt()

convThresh

Same as in bayesOpt()

gsPoints

Same as in bayesOpt()

parallel

Same as in bayesOpt()

verbose

Should warnings be shown before results are returned prematurely?

Value

A data table of local optimums, including the utility (gpUtility), the utility relative to the max utility (relUtility), and the steps taken in the L-BFGS-B method (gradCount).

Details

gsPoints points in the parameter space are randomly initialized, and the L-BFGS-B method is used to find the closest local optimum to each point. dbscan is then used to cluster points together which converged to the same optimum - only unique optimums are returned.

Examples

scoringFunction <- function(x) {
  a <- exp(-(2-x)^2)*1.5
  b <- exp(-(4-x)^2)*2
  c <- exp(-(6-x)^2)*1
  return(list(Score = a+b+c))
}

bounds <- list(x = c(0,8))

Results <- bayesOpt(
    FUN = scoringFunction
  , bounds = bounds
  , initPoints = 3
  , iters.n = 2
  , gsPoints = 10
)
#> Ran initial scoring function 3 times in 1 thread: 0.684999999999999 seconds.
#> Starting Epoch 1
#>   1) Fitting Gaussian Process...
#>   - Convergence Not Found. Trying again with tighter parameters...
#>   - Convergence Not Found. Trying again with tighter parameters...
#>   - Convergence Not Found. Trying again with tighter parameters...
#>   - Maximum convergence attempts exceeded - process is probably sampling random
#>   points.
#>   2) Ran local optimum search: 1.018 seconds.
#>   3) Ran `FUN()` 1 time in 1 thread: 0.234999999999999 seconds.
#> Starting Epoch 2
#>   1) Fitting Gaussian Process...
#>   2) Ran local optimum search: 0.0499999999999972 seconds.
#>   3) Ran `FUN()` 1 time in 1 thread: 0.233000000000004 seconds.
print(getLocalOptimums(Results))
#>    localOptimum        x gpUtility relUtility gradCount
#>           <int>    <num>     <num>      <num>     <num>
#> 1:            1 8.000000 0.5330484  0.9787271         2
#> 2:            2 4.558688 0.5446344  1.0000000         7
#> 3:            3 1.481529 0.3684267  0.6764661         9