RNAmf_two_level {RNAmf} | R Documentation |
The function fits RNA models with designs of two fidelity levels. The estimation method is based on MLE. Possible kernel choices are squared exponential, Matern kernel with smoothness parameter 1.5 and 2.5. The function returns fitted model at level 1 and 2, whether constant mean or not, and kernel choice.
RNAmf_two_level(X1, y1, X2, y2, kernel = "sqex", constant = TRUE, ...)
X1 |
vector or matrix of input locations for the low fidelity level. |
y1 |
vector of response values for the low fidelity level. |
X2 |
vector or matrix of input locations for the high fidelity level. |
y2 |
vector of response values for the high fidelity level. |
kernel |
character specifying kernel type to be used, to be chosen between |
constant |
logical indicating for constant mean of GP ( |
... |
for compatibility with |
Consider the model
\begin{cases}
& f_1(\bm{x}) = W_1(\bm{x}),\\
& f_2(\bm{x}) = W_2(\bm{x}, f_1(\bm{x})),
\end{cases}
where f_l
is the simulation code at fidelity level l
, and
W_l(\bm{x}) \sim GP(\alpha_l, \tau_l^2 K_l(\bm{x}, \bm{x}'))
is GP model.
Hyperparameters (\alpha_l, \tau_l^2, \bm{\theta_l})
are estimated by
maximizing the log-likelihood via an optimization algorithm "L-BFGS-B".
For constant=FALSE
, \alpha_l=0
.
Covariance kernel is defined as:
K_l(\bm{x}, \bm{x}')=\prod^d_{j=1}\phi(x_j,x'_j;\theta_{lj})
with
\phi(x, x';\theta) = \exp \left( -\frac{ \left( x - x' \right)^2}{\theta} \right)
for squared exponential kernel; kernel="sqex"
,
\phi(x,x';\theta) =\left( 1+\frac{\sqrt{3}|x- x'|}{\theta} \right) \exp \left( -\frac{\sqrt{3}|x- x'|}{\theta} \right)
for Matern kernel with the smoothness parameter of 1.5; kernel="matern1.5"
and
\phi(x, x';\theta) = \left( 1+\frac{\sqrt{5}|x-x'|}{\theta} +\frac{5(x-x')^2}{3\theta^2} \right) \exp \left( -\frac{\sqrt{5}|x-x'|}{\theta} \right)
for Matern kernel with the smoothness parameter of 2.5; kernel="matern2.5"
.
For details, see Heo and Sung (2023+, <arXiv:2309.11772>).
fit1
: list of fitted model for (X_1, y_1)
.
fit2
: list of fitted model for ((X_2, f_1(X_2)), y_2)
.
constant
: copy of constant
.
kernel
: copy of kernel
.
level
: a level of the fidelity. It returns 2.
time
: a scalar of the time for the computation.
predict.RNAmf
for prediction.
### two levels example ###
library(lhs)
### Perdikaris function ###
f1 <- function(x) {
sin(8 * pi * x)
}
f2 <- function(x) {
(x - sqrt(2)) * (sin(8 * pi * x))^2
}
### training data ###
n1 <- 13
n2 <- 8
### fix seed to reproduce the result ###
set.seed(1)
### generate initial nested design ###
X <- NestedX(c(n1, n2), 1)
X1 <- X[[1]]
X2 <- X[[2]]
### n1 and n2 might be changed from NestedX ###
### assign n1 and n2 again ###
n1 <- nrow(X1)
n2 <- nrow(X2)
y1 <- f1(X1)
y2 <- f2(X2)
### fit an RNAmf ###
fit.RNAmf <- RNAmf_two_level(X1, y1, X2, y2, kernel = "sqex")