Learn R Programming

CEGO (version 2.0.0)

modelKriging: Kriging Model

Description

Implementation of a distance-based Kriging model, e.g., for mixed or combinatorial input spaces. It is based on employing suitable distance measures for the samples in input space.

Usage

modelKriging(x, y, distanceFunction, control = list())

Arguments

x
list of samples in input space
y
column vector of observations for each sample
distanceFunction
a suitable distance function of type f(x1,x2), returning a scalar distance value, preferably between 0 and 1. Maximum distances larger 1 are no problem, but may yield scaling bias when different measures are compared. Should be non-negative and symme
control
(list), with the options for the model building procedure: lower lower boundary for theta, default is 1e-6 upper upper boundary for theta, default is 100 corr function to be used for correla

Value

  • an object of class modelKriging containing the options and determined parameters for the model: x (see parameters) y (see parameters) lower (see parameters) upper (see parameters) algTheta (see parameters) algThetaControl (see parameters) optimizeP (see parameters) theta activity or width parameter theta, a parameter of the correlation function determined with MLE log10Theta log10 theta (i.e. log10(theta)) lambda regularization constant (nugget) lambda log10Lambda log10 of regularization constant (nugget) lambda (i.e. log10(lambda)) p exponent p, parameter of the correlation function determined with MLE (if optimizeP is TRUE) yMu vector of observations y, minus MLE of mu SSQ Maximum Likelihood Estimate (MLE) of model parameter sigma^2 mu MLE of model parameter mu Psi correlation matrix Psi Psinv inverse of Psi nevals number of Likelihood evaluations during MLE of theta/lambda/p scaling Default is FALSE. If TRUE: Distances values are divided by maximum distance to independent of the scale of the distance function. distanceFunctionIndexMLE If a list of several distance measures (distanceFunction) was given, this parameter contains the index value of the measure chosen with MLE.

Details

The basic Kriging implementation is based on the work of Forrester et al. (2008). For adaptation of Kriging to mixed or combinatorial spaces, as well as choosing distance measures with Maximum Likelihood Estimation, see the other two references (Zaefferer et al., 2014).

References

Forrester, Alexander I.J.; Sobester, Andras; Keane, Andy J. (2008). Engineering Design via Surrogate Modelling - A Practical Guide. John Wiley & Sons. Zaefferer, Martin; Stork, Joerg; Friese, Martina; Fischbach, Andreas; Naujoks, Boris; Bartz-Beielstein, Thomas. (2014). Efficient global optimization for combinatorial problems. In Proceedings of the 2014 conference on Genetic and evolutionary computation (GECCO '14). ACM, New York, NY, USA, 871-878. DOI=10.1145/2576768.2598282 http://doi.acm.org/10.1145/2576768.2598282 Zaefferer, Martin; Stork, Joerg; Bartz-Beielstein, Thomas. (2014). Distance Measures for Permutations in Combinatorial Efficient Global Optimization. In Parallel Problem Solving from Nature - PPSN XIII (p. 373-383). Springer International Publishing.

See Also

predict.modelKriging

Examples

Run this code
#Set random number generator seed
set.seed(1)
#Simple test landscape
fn <- landscapeGeneratorUNI(1:5,distancePermutationHamming)
#Generate data for training and test
x <- unique(replicate(40,sample(5),FALSE))
xtest <- x[-(1:15)]
x <- x[1:15]
#Determin true objective function values
y <- fn(x)
ytest <- fn(xtest)
#Build model
fit <- modelKriging(x,y,distancePermutationHamming,
    control=list(algThetaControl=list(method="L-BFGS-B"),useLambda=FALSE))
#Predicted obj. function values
ypred <- predict(fit,xtest)$y
#Uncertainty estimate
fit$predAll <- TRUE
spred <- predict(fit,xtest)$s
#Plot
plot(ytest,ypred,xlab="true value",ylab="predicted value",
    pch=20,xlim=c(0.3,1),ylim=c(min(ypred)-0.1,max(ypred)+0.1))
segments(ytest, ypred-spred,ytest, ypred+spred)
epsilon = 0.02
segments(ytest-epsilon,ypred-spred,ytest+epsilon,ypred-spred)
segments(ytest-epsilon,ypred+spred,ytest+epsilon,ypred+spred)
abline(0,1,lty=2)
#Use a different/custom optimizer (here: SANN) for maximum likelihood estimation:
#(Note: Bound constraints are recommended, to avoid Inf values.
#This is really just a demonstration. SANN does not respect bound constraints.)
optimizer1 <- function(x,fun,lower=NULL,upper=NULL,control=NULL,...){
  res <- optim(x,fun,method="SANN",control=list(maxit=100),...)
  list(xbest=res$par,ybest=res$value,count=res$counts)
}
fit <- modelKriging(x,y,distancePermutationHamming,
                   control=list(algTheta=optimizer1,useLambda=FALSE))
#One-dimensional optimizer (Brent). Note, that Brent will not work when
#several parameters have to be set, e.g., when using nugget effect (lambda).
#However, Brent may be quite efficient otherwise.
optimizer2 <- function(x,fun,lower,upper,control=NULL,...){
 res <- optim(x,fun,method="Brent",lower=lower,upper=upper,...)
 list(xbest=res$par,ybest=res$value,count=res$counts)
}
fit <- modelKriging(x,y,distancePermutationHamming,
                    control=list(algTheta=optimizer2,useLambda=FALSE))

Run the code above in your browser using DataLab