Build Forrester Co-Kriging

Description

This function builds a Co-Kriging model based on code by Forrester et al.. Please note that the expensive sample locations should be contained in the cheap sample locations. Furthermore, it has to be made sure that the correlated functions do not yield identical values. That is, ye and yc should have common sample locations, but different values. The sample locations only evaluated on the cheap function can be chosen arbitrarily.

Usage

1
2
forrCoBuilder(Xe, ye, Xc, yc, fitC, lb = NULL, ub = NULL,
  control = list())

Arguments

Xe

design matrix (expensive sample locations)

ye

1-row matrix of expensive observations at Xe

Xc

design matrix (cheap sample locations). The bottom of this matrix should contain expensive samples.

yc

1-row matrix of cheap observations at Xc.

fitC

object of class forr, containing a Kriging model build through the cheap observations

lb

lower boundary of the design space. Will be extracted from the matrix Xe if not given.

ub

upper boundary of the design space. Will be extracted from the matrix Xe if not given.

control

(list), with the options for the model building procedure:
loval lower boundary for theta, default is 1e-6
upval upper boundary for theta, default is 100
corr function to be used for correlation modeling, default is fcorrGauss
algtheta algorithm used to find theta, default is "NLOPT_LN_NELDERMEAD". Else, any from the list of possible method values in spotOptimizationInterface from the SPOT package can be chosen.
budgetalgtheta budget for the above mentioned algorithm, default is 100. The value will be multiplied with the length of the model parameter vector to be optimized. opt.p boolean that specifies whether the exponents (p) should be optimized. Else they will be set to two.
uselambda whether or not to use the regularization constant lambda (nugget effect). Default is FALSE. lambda.loval lower boundary for lambda, default is -6
lambda.upval upper boundary for lambda, default is 0
rho.loval lower boundary for rho, default is -5
rho.upval upper boundary for rho, default is 5
starttheta optional start value for theta. reinterpolate whether (TRUE) or not (FALSE, default) reinterpolation should be performed

Value

a fit (list) of class coforr. This contains Co-Kriging specific parameters, as well as two fits of class forr which represent the cheap and expensive models.

References

Forrester, Alexander I.J.; Sobester, Andras; Keane, Andy J. (2008). Engineering Design via Surrogate Modelling - A Practical Guide. John Wiley & Sons.

FORRESTER, A.I.J, SOBESTER A. & KEAN, A.J. (2007), Multi-Fidelity optimization via surrogate modelling. Proc. R. Soc. A 463, 3251-3269.
Forrester, Alexander I.J.; Sobester, Andras; Keane, Andy J. (2008). Engineering Design via Surrogate Modelling - A Practical Guide. John Wiley & Sons.

See Also

spotPredictCoForrester forrCoRegPredictor forrBuilder

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
## This is the one-variable example described by Forrester et al.
## The "expensive" function to be modeled is
ovar <- function(x){(x*6-2)^2*sin((x*6-2)*2)}
## The "cheap" function to be modeled is
covar <- function(x){ A=0.5;B=10;C=-5;D=0;
	A*(((x+D)*6-2)^2)*sin(((x+D)*6-2)*2)+((x+D)-0.5)*B+C
}
## construct cheap and expensive sample locations
xe <- rbind(0,0.4,0.6,1)
xc <- rbind(0.1,0.2,0.3,0.5,0.7,0.8,0.9,0,0.4,0.6,1)
## get observations of samples
ye <- rbind(ovar(xe))
yc <- rbind(covar(xc))
	## build the Co-Kriging model, with cheap and expensive observations
set.seed(1)
 fitC <- forrBuilder(xc, yc)
fit <- forrCoBuilder(xe, ye, xc, yc, fitC)
	## build the ordinary Kriging model with expensive observations only
fit1 <- forrBuilder(xe, ye)	 
 ## Predict and plot over whole design space
x<-seq(from=0,to=1,by=0.01)
yco <- forrCoRegPredictor(as.matrix(x),fit,FALSE)$f
ypc <- predict(fitC,as.matrix(x),FALSE)$f
	fit2 <- fit
 class(fit2) <- "forr"
ype <- predict(fit2,as.matrix(x),FALSE)$f
yy <- predict(fit1,as.matrix(x),FALSE)$f
plot(x,ovar(x),type="l",ylim=c(-15,20),lwd=3)
points(xe,ye,pch=19,cex=1.5)
points(xc,yc,cex=1.5)
lines(x,covar(x),lwd=3)	
	lines(x,ype,col="blue",lwd=3) #difference model 
lines(x,ypc,col="red",lty=4,lwd=3) 	#cheap model
lines(x,yy,col="blue",lty=3,lwd=3)#uncorrected model
lines(x,yco,col="darkgreen",lty=5,lwd=3) #comodel
legend("top",lwd=c(3,3,1,1,3,3,3,3),
	col=c("black","black","black","black","blue","red","blue","darkgreen"),
	legend=	c("Expensive Function", "Cheap Function", 
			"Expensive Observations", "Cheap Observations",
			"Uncorrected Model", "Cheap Model","Difference Model",
			"Co-Kriging Model"),
	lty=c(1,1,0,0,3,4,1,5),pch=c(NA,NA,19,1,NA,NA,NA,NA))
sum((yco-ovar(x))^2)/length(x) #mse

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.