Skip to contents

Use this function to continue optimization of a bayesOpt object.

Usage

addIterations(
  optObj,
  iters.n = 1,
  iters.k = 1,
  otherHalting = list(timeLimit = Inf, minUtility = 0),
  bounds = optObj$bounds,
  acq = optObj$optPars$acq,
  kappa = optObj$optPars$kappa,
  eps = optObj$optPars$eps,
  gsPoints = optObj$optPars$gsPoints,
  convThresh = optObj$optPars$convThresh,
  acqThresh = optObj$optPars$acqThresh,
  errorHandling = "stop",
  saveFile = optObj$saveFile,
  parallel = FALSE,
  plotProgress = FALSE,
  verbose = 1,
  ...
)

Arguments

optObj

an object of class bayesOpt.

iters.n

The total number of additional times to sample the scoring function.

iters.k

integer that specifies the number of times to sample FUN at each Epoch (optimization step). If running in parallel, good practice is to set iters.k to some multiple of the number of cores you have designated for this process. Must belower than, and preferrably some multiple of iters.n.

otherHalting

Same as bayesOpt()

bounds

Same as bayesOpt()

acq

Same as bayesOpt()

kappa

Same as bayesOpt()

eps

Same as bayesOpt()

gsPoints

Same as bayesOpt()

convThresh

Same as bayesOpt()

acqThresh

Same as bayesOpt()

errorHandling

Same as bayesOpt()

saveFile

Same as bayesOpt()

parallel

Same as bayesOpt()

plotProgress

Same as bayesOpt()

verbose

Same as bayesOpt()

...

Same as bayesOpt()

Value

An object of class bayesOpt having run additional iterations.

Details

By default, this function uses the original parameters used to create optObj, however the parameters (including the bounds) can be customized. If new bounds are used which cause some of the prior runs to fall outside of the bounds, these samples are removed from the optimization procedure, but will remain in scoreSummary. FUN should return the same elements and accept the same inputs as the original, or this function may fail.

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 = 1
  , gsPoints = 10
)
#> Ran initial scoring function 3 times in 1 thread: 0.664999999999999 seconds.
#> Starting Epoch 1
#>   1) Fitting Gaussian Process...
#>   2) Ran local optimum search: 0.202999999999999 seconds.
#>   3) Ran `FUN()` 1 time in 1 thread: 0.234 seconds.
Results <- addIterations(Results,iters.n=1)
#> Starting Epoch 2
#>   1) Fitting Gaussian Process...
#>   2) Ran local optimum search: 0.0530000000000008 seconds.
#>   3) Ran `FUN()` 1 time in 1 thread: 0.231999999999999 seconds.