if (FALSE) {
# load the package and the Python env
library(dgpsi)
# construct the borehole function over a hypercube
f <- function(x){
x[,1] <- (0.15 - 0.5) * x[,1] + 0.5
x[,2] <- exp((log(50000) - log(100)) * x[,2] + log(100))
x[,3] <- (115600 - 63070) *x[,3] + 63070
x[,4] <- (1110 - 990) * x[,4] + 990
x[,5] <- (116 - 63.1) * x[,5] + 63.1
x[,6] <- (820 - 700) * x[,6] + 700
x[,7] <- (1680 - 1120) * x[,7] + 1120
x[,8] <- (12045 - 9855) * x[,8] + 9855
y <- apply(x, 1, RobustGaSP::borehole)
}
# set a random seed
set_seed(999)
# generate training data
X <- maximinLHS(80, 8)
Y <- f(X)
# generate validation data
validate_x <- maximinLHS(500, 8)
validate_y <- f(validate_x)
# training a DGP emulator with anisotropic squared exponential kernels
m <- dgp(X, Y, share = F)
# OOS validation of the DGP emulator
plot(m, validate_x, validate_y)
# prune the emulator until no more GP nodes are removable
m <- prune(m)
# OOS validation of the resulting emulator
plot(m, validate_x, validate_y)
}
Run the code above in your browser using DataLab