Skip to content

Commit a4403f7

Browse files
committed
update README
1 parent aba9431 commit a4403f7

17 files changed

+29
-130
lines changed

README.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1-
This folder consists of the R code for the manuscript “*Stacking designs: designing multi-fidelity computer experiments with confidence*” by Sung, Ji, Tang, and Mak.
1+
This instruction aims to reproduce the results in the paper “*Stacking
2+
designs: designing multi-fidelity computer experiments with confidence*
3+
by [Sung, Ji, Mak, Wang, and Tang
4+
(2023+)](https://arxiv.org/abs/2211.00268), recently accepted by
5+
SIAM/ASA Journal on Uncertainty Quantification.
26

3-
The code folder reproduces the result in Section 5 of the manuscript.
7+
The code folder reproduces the result in Section 5 of the manuscript.
48

5-
- `currin_example.R` reproduces the results of Section 5.1.
6-
- `poisson_example.R` reproduces the results of Section 5.2.
7-
- `blade_example.R` reproduces the results of Section 5.3.
8-
- Note: this code could take a long time because it runs very high fidelity simulations.
9-
9+
- `currin_example.R` reproduces the results of Section 5.1.
10+
- `poisson_example.R` reproduces the results of Section 5.2.
11+
- `blade_example.R` reproduces the results of Section 5.3.
1012

1113
The following R packages are required to run the code:
12-
- `matlabr (>=1.5.2)`
13-
- `randtoolbox (>=2.0.2)`
14-
- `RColorBrewer (>=1.1-3)`
15-
- `ggplot2 (>=3.3.6)`
16-
- `gridExtra (>=2.3)`
17-
- `plgp (>=1.1-11)`
14+
15+
- `matlabr (>=1.5.2)`
16+
- `randtoolbox (>=2.0.2)`
17+
- `RColorBrewer (>=1.1-3)`
18+
- `ggplot2 (>=3.3.6)`
19+
- `gridExtra (>=2.3)`
20+
- `plgp (>=1.1-11)`
21+
22+
`MATLAB` needs to be installed in order to run the finite element
23+
simulations. The MATLAB code can be accessed from the folder
24+
`Rmatlab_files`.

blade_example.R

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ log.fg <- TRUE
3838

3939
set.seed(1)
4040
X.test <- maximinLHS(20,2)
41-
y.test <- f(X.test,l=5, MM, tt, return.time=TRUE)
42-
# load("2d_jet_blade_true.Rdata")
43-
# y.test <- true.save
41+
#y.test <- f(X.test,l=5, MM, tt, return.time=TRUE)
42+
# running this high fidelity can take a long time
43+
# therefore, the outputs of y.test are stored as "2d_jet_blade_true.Rdata"
44+
load("2d_jet_blade_true.Rdata")
45+
y.test <- true.save
4446

4547
ML.out <- stacking_design(cost, d, n.init, epsilon=5, alpha,
4648
tt, MM, Lmax, f, k, xnew, n.max,
@@ -151,40 +153,7 @@ g4 <- g4 + theme(axis.text.y = element_text(size = 12))
151153
grid.arrange(g1, g2, g3, g4, ncol = 4)
152154
dev.off()
153155

154-
155-
# Figure 12 (no longer needed)
156-
# pdf("alpha_estimation_blade.pdf", width=6, height=2.5)
157-
# z.val <- c(ML.out$z[[2]][1:ML.out$n.save[[3]][2]], ML.out$z[[3]][1:ML.out$n.save[[3]][3]])
158-
# df_alpha <- data.frame(mesh_l=rep(1/tt^(2:3), ML.out$n.save[[3]][2:3]),
159-
# z=abs(z.val))
160-
# lm.fit <- lm(log(z) ~ log(mesh_l), data=df_alpha)
161-
#
162-
# g1 <- ggplot(df_alpha, aes(x=log(mesh_l), y=log(z), group=log(mesh_l))) +
163-
# geom_boxplot(fill='#A4A4A4', color="black", width=0.25)+
164-
# xlab(expression(log(italic(T^-l))))+ylab(bquote("log|" ~ f[italic(l)] ~ "(x) -" ~ f[italic(l)-1] ~ "(x)|"))+#ylab(bquote("log|" ~ z[italic(l)] ~ "|"))+
165-
# theme_bw()+ggtitle(expression(italic(L)==3)) + theme(plot.title = element_text(hjust = 0.5))
166-
#
167-
# g1 <- g1 + geom_abline(intercept = lm.fit$coefficients[1],
168-
# slope = lm.fit$coefficients[2], color = "red", linetype = "dashed")
169-
#
170-
# z.val <- unlist(ML.out$z[2:4])
171-
# df_alpha <- data.frame(mesh_l=rep(1/tt^(2:4), ML.out$n[2:4]),
172-
# z=abs(z.val))
173-
# lm.fit <- lm(log(z) ~ log(mesh_l), data=df_alpha)
174-
#
175-
# g2 <- ggplot(df_alpha, aes(x=log(mesh_l), y=log(z), group=log(mesh_l))) +
176-
# geom_boxplot(fill='#A4A4A4', color="black", width=0.25)+
177-
# xlab(expression(log(italic(T^-l))))+ylab(bquote("log|" ~ f[italic(l)] ~ "(x) -" ~ f[italic(l)-1] ~ "(x)|"))+#ylab(bquote("log|" ~ z[italic(l)] ~ "|"))+
178-
# theme_bw() + ggtitle(expression(italic(L)==4)) + theme(plot.title = element_text(hjust = 0.5))
179-
#
180-
# g2 <- g2 + geom_abline(intercept = lm.fit$coefficients[1],
181-
# slope = lm.fit$coefficients[2], color = "red", linetype = "dashed")
182-
#
183-
# grid.arrange(g1, g2, ncol = 2)
184-
# dev.off()
185-
186-
187-
# Figure 13
156+
# Figure 10
188157
pdf("blade_prediction.pdf", width=7.5, height = 3.3)
189158
par(mfrow=c(1,2))
190159
par(mar=c(2,1,0,0))

currin_example.R

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -170,36 +170,6 @@ grid.arrange(g1, g2, g3, g4, ncol = 4)
170170
dev.off()
171171

172172

173-
# Figure 5 (no longer needed)
174-
# pdf("alpha_estimation.pdf", width=6, height=2.5)
175-
# z.val <- c(ML.out$z[[2]][1:ML.out$n.save[[3]][2]], ML.out$z[[3]][1:ML.out$n.save[[3]][3]])
176-
# df_alpha <- data.frame(mesh_l=rep(1/tt^(2:3), ML.out$n.save[[3]][2:3]),
177-
# z=abs(z.val))
178-
# lm.fit <- lm(log(z) ~ log(mesh_l), data=df_alpha)
179-
#
180-
# g1 <- ggplot(df_alpha, aes(x=log(mesh_l), y=log(z), group=log(mesh_l))) +
181-
# geom_boxplot(fill='#A4A4A4', color="black", width=0.25)+
182-
# xlab(expression(log(italic(T^-l))))+ylab(bquote("log|" ~ f[italic(l)] ~ "(x) -" ~ f[italic(l)-1] ~ "(x)|"))+#ylab(bquote("log|" ~ z[italic(l)] ~ "|"))+
183-
# theme_bw()+ggtitle(expression(italic(L)==3)) + theme(plot.title = element_text(hjust = 0.5))
184-
#
185-
# g1 <- g1 + geom_abline(intercept = lm.fit$coefficients[1],
186-
# slope = lm.fit$coefficients[2], color = "red", linetype = "dashed")
187-
#
188-
# z.val <- unlist(ML.out$z[2:4])
189-
# df_alpha <- data.frame(mesh_l=rep(1/tt^(2:4), ML.out$n[2:4]),
190-
# z=abs(z.val))
191-
# lm.fit <- lm(log(z) ~ log(mesh_l), data=df_alpha)
192-
#
193-
# g2 <- ggplot(df_alpha, aes(x=log(mesh_l), y=log(z), group=log(mesh_l))) +
194-
# geom_boxplot(fill='#A4A4A4', color="black", width=0.25)+
195-
# xlab(expression(log(italic(T^-l))))+ylab(bquote("log|" ~ f[italic(l)] ~ "(x) -" ~ f[italic(l)-1] ~ "(x)|"))+#ylab(bquote("log|" ~ z[italic(l)] ~ "|"))+
196-
# theme_bw() + ggtitle(expression(italic(L)==4)) + theme(plot.title = element_text(hjust = 0.5))
197-
#
198-
# g2 <- g2 + geom_abline(intercept = lm.fit$coefficients[1],
199-
# slope = lm.fit$coefficients[2], color = "red", linetype = "dashed")
200-
#
201-
# grid.arrange(g1, g2, ncol = 2)
202-
# dev.off()
203173

204174

205175

@@ -261,7 +231,7 @@ df2$meshsize <- factor(MM/tt^as.numeric(df2$meshsize))
261231
df1$meshsize <- factor(df1$meshsize, levels = c(8, 4, 2, 1, 0.5))
262232
df2$meshsize <- factor(df2$meshsize, levels = c(8, 4, 2, 1, 0.5))
263233

264-
# Figure 6
234+
# Figure 5
265235
my.cols <- brewer.pal(6, "Blues")
266236
pdf(paste0("illustration epsilon.pdf"), width=11, height=2.8)
267237
g1 <- ggplot(data=df1, aes(x=factor(epsilon))) +
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)