max_EI_cmaes: Maximization of the Expected Improvement Criterion using...

View source: R/max_EI.R

max_EI_cmaesR Documentation

Maximization of the Expected Improvement Criterion using cmaes

Description

Given an object in km-class and a set of tuning parameters (lower, upper, parinit, and cmaes_args), max_EI_cmaes performs the maximization of the Expected Improvement criterion and delivers the next point to be visited in an EGO-like procedure.

Usage

max_EI_cmaes(
  model,
  plugin = NULL,
  type = c("UK", "SK"),
  lower,
  upper,
  parinit = NULL,
  minimization = TRUE,
  cmaes_args = NULL
)

Arguments

model

An object inheriting from the class "km", for example and object with class "KM" from the package rlibkriging.

plugin

Optional scalar: if provided, it replaces the minimum of the current observations.

type

Character "UK" (default) or "SK" giving the kriging type.

lower, upper

Numeric vectors of length d giving the lower and upper bounds for the variables to be optimized over.

parinit

Optional numeric vector of initial values for the variables to be optimized over.

minimization

Logical specifying if EI is used in minimization or in maximization. Of course, this concerns the objective function to be optimized, not the EI which is always maximized.

cmaes_args

Optional named list of arguments for the cma_es optimization function. This list will contain one element named control which is itself a list. Note that be it given or not the element fnscale will be internally set to -1 to achieve a maximization of the EI.

Details

The latter maximization relies on the cma_es function for global optimization. As opposed to max_EI_genoud, the optimization does not use the gradient of the objective.

The current minimum of the observations can be replaced by an arbitrary value given in plugin, which is useful in particular in noisy frameworks.

Value

A list with several elements among which:

  • par A numeric matrix with 1 row and d columns the best set of parameters found.

  • value A numeric vector with length one, giving the value of expected improvement at par.

The matrix par will often have to be coerced into a data frame (see Examples or into a numeric vector.

Examples

library(cmaes)
set.seed(123)

## =========================================================================
##  "ONE-SHOT" EI-MAXIMIZATION OF THE BRANIN FUNCTION 
## 	KNOWN AT A 9-POINTS FACTORIAL DESIGN         
## =========================================================================

## a 9-points factorial design, and the corresponding response
## ===========================================================
d <- 2; n <- 9
design.fact <- expand.grid(x1 = seq(0, 1, length = 3),
                           x2 = seq(0, 1, length = 3)) 
y.branin <- apply(design.fact, 1, branin)

## model fitting
## =============
mykm <- km(~1, design = design.fact, response = y.branin, 
           covtype="gauss", control = list(pop.size = 50, trace = FALSE),
           parinit = c(0.5, 0.5))

## EGO one step
## ============
lower <- rep(0.0, d); upper <- rep(1.0, d)    
EGOkm <- max_EI_cmaes(mykm, lower = lower, upper = upper, 
                      cmaes_args = list(control = list(maxit = 1e6)))
EGOkm$par
EGOkm$value

## The same with a KM object
## =========================
if (require(rlibkriging)) {
    myKM <- KM(~1, design = design.fact, response = y.branin, 
               covtype="gauss", parinit = c(0.5, 0.5))
     lower <- rep(0.0, d); upper <- rep(1.0, d)    
     EGOKM <- max_EI_cmaes(myKM, lower = lower, upper = upper, 
                      cmaes_args = list(control = list(maxit = 1e6)))
     EGOKM$par
     EGOKM$value
}


libKriging/dolka documentation built on April 14, 2022, 7:17 a.m.