Skip to contents

To save time, Gaussian processes are not updated after the last iteration in addIterations(). The user can do this manually, using this function if they wish. This is not necessary to continue optimization using addIterations.

Usage

updateGP(optObj, bounds = optObj$bounds, verbose = 1, ...)

Arguments

optObj

an object of class bayesOpt

bounds

The bounds to scale the parameters within.

verbose

Should the user be warned if the GP is already up to date?

...

passed to DiceKriging::km()

Value

An object of class bayesOpt with updated Gaussian processes.

Examples

# Create initial object
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.725999999999999 seconds.
#> Starting Epoch 1
#>   1) Fitting Gaussian Process...
#>   2) Ran local optimum search: 0.177 seconds.
#>   3) Ran `FUN()` 1 time in 1 thread: 0.25 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.249000000000002 seconds.

# At this point, the Gaussian Process has not been updated
# with the most recent results. We can update it manually:
Results <- updateGP(Results)