tgpoptim: Bayesian Optimization by a (treed) Bayesian Gaussian Process...

View source: R/tgpoptim.R

tgpoptimR Documentation

Bayesian Optimization by a (treed) Bayesian Gaussian Process Prior (with jumps to linear models) surrogate model Essentially a wrapper for the functionality in tgp that has the same slots as optim with defaults for STOPS models.

Description

Bayesian Optimization by a (treed) Bayesian Gaussian Process Prior (with jumps to linear models) surrogate model Essentially a wrapper for the functionality in tgp that has the same slots as optim with defaults for STOPS models.

Usage

tgpoptim(
  x,
  fun,
  ...,
  initpoints = 10,
  lower,
  upper,
  acc = 1e-08,
  itmax = 10,
  verbose = 0,
  model = "bgp"
)

Arguments

x

optional starting values

fun

function to minimize

...

additional arguments to be passed to the function to be optimized

initpoints

the number of points to sample initially to fit the surrogate model

lower

The lower contraints of the search region

upper

The upper contraints of the search region

acc

if the numerical accuracy of two successive target function values is below this, stop the optimization; defaults to 1e-8

itmax

maximum number of iterations

verbose

numeric value hat prints information on the fitting process; >2 is extremely verbose

model

which surrogate model class to use (currently uses defaults only, will extend this to tweak the model)

Value

A list with the components (for compatiility with optim)

  • par The position of the optimum in the search space (parameters that minimize the function; argmin fun).

  • value The value of the objective function at the optimum (min fun). Note we do not use the last value in the candidate list but the best candidate (which can but need not coincide).

  • svalue The value of the surrogate objective function at the optimal parameters

  • counts The number of iterations performed at convergence with entries fnction for the number of iterations and gradient which is always NA at the moment

  • convergence 0 successful completion by the accd or acc criterion, 1 indicate iteration limit was reached, 99 is a problem

  • message is NULL (only for compatibility or future use)

  • history the improvement history

  • tgpout the output of the tgp model

Examples


fbana <- function(x) {
x1 <- x[1]
x2 <- x[2]
100 * (x2 - x1 * x1)^2 + (1 - x1)^2
}
res1<-tgpoptim(c(-1.2,1),fbana,lower=c(-5,-5),upper=c(5,5),acc=1e-16,itmax=20)
res1

fwild <- function (x) 10*sin(0.3*x)*sin(1.3*x^2) + 0.00001*x^4 + 0.2*x+80
plot(fwild, -50, 50, n = 1000, main = "Bayesian GP Optimization minimizing 'wild function'")
set.seed(210485)
res2<-tgpoptim(50, fwild,lower=-50,upper=50,acc=1e-16,itmax=20,model="btgpllm")
points(res2$par,res2$value,col="red",pch=19)
res2


stops documentation built on Dec. 12, 2023, 3:02 a.m.