# NOT RUN {
# Only use 4 dims of 8 for borehole function
cf_highdim(function(x) TestFunctions::borehole(c(x,.5,.5,.5,.5)), 4)
# Add points
cf_highdim(function(x) TestFunctions::borehole(c(x,.5,.5,.5,.5)), 4,
pts=matrix(c(.1,.3,.6,.9),1,4))
# Full 8D borehole function
cf_highdim(TestFunctions::borehole, 8)
# Putting each plot on separate scale
cf_highdim(TestFunctions::borehole, 8, n=10, same_scale = FALSE)
# }
# NOT RUN {
cf_highdim(function(x) {x[1]^2 + exp(x[2])}, D=3)
friedman <- function(x) {
10*sin(pi*x[1]*x[2]) + 20*(x[3]-.5)^2 + 10*x[4] + 5*x[5]
}
cf_highdim(friedman, 5, color.palette=topo.colors)
cf_highdim(friedman, 5,
color.palette=function(x) {gray((1:x)/x)},
nlevels=10)
# }
# NOT RUN {
# Recreate Plate 1 or Figure 1.1 from Engineering Design via Surrogate
# Modelling by Forrester, Sobester, and Keane (2008).
cf_highdim(function(x)TestFunctions::wingweight(x, scale_it=FALSE),
D=10, low = c(150,220,6,-10,16,.5,.08,2.5,1700,.025),
high = c(200,300,10,10,45,1,.18,6,2500,.08),
baseline=c(174,252,7.52,0,34,.672,.12,3.8,2000,.064),
color.palette=topo.colors,
var_names=c('SW', 'Wtw', 'A', 'Lambda', 'q', 'lambda', 'tc', 'Nz', 'Wdg'))
# }
# NOT RUN {
# Average over background dimensions, use higher reps to reduce noise.
f1 <- function(x) {x[1] + x[2]^2 + x[3]^3}
cf_highdim(f1, 4, average=TRUE, average_reps=1e2, n=10)
f1b <- function(x) {x[,1] + x[,2]^2 + x[,3]^3}
cf_highdim(f1b, 4, average=TRUE, average_reps=1e2, n=10, batchmax=Inf)
cf_highdim(f1b, 4, average_reps=1e2, n=10, batchmax=Inf,
color.palette = topo.colors, nlevels=3)
# This was giving bad result
csa()
split.screen(c(2,1))
screen(2)
cf_highdim(f1b, 4, n=10, batchmax=Inf)
csa()
# }
Run the code above in your browser using DataCamp Workspace