Learn R Programming

DiceOptim (version 2.0)

EI.grad: Analytical gradient of the Expected Improvement criterion

Description

Computes the gradient of the Expected Improvement at the current location. The current minimum of the observations can be replaced by an arbitrary value (plugin), which is usefull in particular in noisy frameworks.

Usage

EI.grad(x, model, plugin = NULL, type = "UK", minimization = TRUE, envir = NULL)

Arguments

x
a vector representing the input for which one wishes to calculate EI.
model
an object of class km.
plugin
optional scalar: if provided, it replaces the minimum of the current observations,
type
Kriging type: "SK" or "UK"
minimization
logical specifying if EI is used in minimiziation or in maximization,
envir
an optional environment specifying where to get intermediate values calculated in EI.

Value

The gradient of the expected improvement criterion with respect to x. Returns 0 at design points (where the gradient does not exist).

References

D. Ginsbourger (2009), Multiples metamodeles pour l'approximation et l'optimisation de fonctions numeriques multivariables, Ph.D. thesis, Ecole Nationale Superieure des Mines de Saint-Etienne, 2009. https://tel.archives-ouvertes.fr/tel-00772384/

J. Mockus (1988), Bayesian Approach to Global Optimization. Kluwer academic publishers.

T.J. Santner, B.J. Williams, and W.J. Notz (2003), The design and analysis of computer experiments, Springer.

M. Schonlau (1997), Computer experiments and global optimization, Ph.D. thesis, University of Waterloo.

See Also

EI

Examples

Run this code
## Not run: 
# set.seed(123)
# # a 9-points factorial design, and the corresponding response
# d <- 2; n <- 9
# design.fact <- expand.grid(seq(0,1,length=3), seq(0,1,length=3))
# names(design.fact)<-c("x1", "x2")
# design.fact <- data.frame(design.fact)
# names(design.fact)<-c("x1", "x2")
# response.branin <- apply(design.fact, 1, branin)
# response.branin <- data.frame(response.branin)
# names(response.branin) <- "y"
# 
# # model identification
# fitted.model1 <- km(~1, design=design.fact, response=response.branin,
# covtype="gauss", control=list(pop.size=50,trace=FALSE), parinit=c(0.5, 0.5))
# 
# # graphics
# n.grid <- 50
# x.grid <- y.grid <- seq(0,1,length=n.grid)
# design.grid <- expand.grid(x.grid, y.grid)
# #response.grid <- apply(design.grid, 1, branin)
# EI.grid <- apply(design.grid, 1, EI,fitted.model1)
# #EI.grid <- apply(design.grid, 1, EI.plot,fitted.model1, gr=TRUE)
# 
# z.grid <- matrix(EI.grid, n.grid, n.grid)
# 
# contour(x.grid,y.grid,z.grid,20)
# title("Expected Improvement for the Branin function known at 9 points")
# points(design.fact[,1], design.fact[,2], pch=17, col="blue")
# 
# # graphics
# n.gridx <- 15
# n.gridy <- 20
# x.grid2 <- seq(0,1,length=n.gridx)
# y.grid2 <- seq(0,1,length=n.gridy)
# design.grid2 <- expand.grid(x.grid2, y.grid2)
# 
# EI.envir <- new.env()
# 	environment(EI) <- environment(EI.grad) <- EI.envir
# 
# options(warn=-1)
# for(i in seq(1, nrow(design.grid2)) )
# {
# 	x <- design.grid2[i,]
# 	ei <- EI(x, model=fitted.model1, envir=EI.envir)
# 	eigrad <- EI.grad(x , model=fitted.model1, envir=EI.envir)
# 	if(!(is.null(ei)))
# 	{
# 	arrows(x$Var1,x$Var2,
# 	x$Var1 + eigrad[1]*2.2*10e-5, x$Var2 + eigrad[2]*2.2*10e-5,
# 	length = 0.04, code=2, col="orange", lwd=2)
# 	}
# }
# ## End(Not run)

Run the code above in your browser using DataLab