MuFiMeshGP: Prediction of the MuFiMeshGP emulator for any fidelity level.

View source: R/MuFiMeshGP.R

MuFiMeshGPR Documentation

Prediction of the MuFiMeshGP emulator for any fidelity level.

Description

The function computes the posterior mean and standard deviation of the MuFiMeshGP model.

Usage

MuFiMeshGP(
  X,
  t,
  Y,
  covtype = "Gaussian",
  trend.type = "OK",
  trend.dim = "input",
  trend.pol = "quadratic",
  interaction = NULL,
  mean.known = NULL,
  H.known = NULL,
  gradient = TRUE,
  init = NULL,
  single_fidelity = FALSE,
  param.bounds = NULL,
  iso = FALSE,
  l = 4,
  nugget = 1e-06,
  ncores = 1
)

Arguments

X

matrix of input locations. Each row represents a sample.

t

vector of fidelity levels. Each element is a sample and is connected to the corresponding row in X.

Y

vector of response values.

covtype

covariance kernel type, only 'Gaussian' is available for now, 'Matern5_2' or 'Matern3_2' will be available soon (see cov_gen).

trend.type, trend.dim, trend.pol, interaction

define the mean function form of the Gaussian process. trend.type can be: "SK" in which case mean.known needs to be specified as a scalar; "OK" in which case the constant mean will be evaluated through MLE; "UK" in which case trend.dim specifies whether the trend will be along the input space ("input"), the fidelity space ("fidelity"), or both ("both"). If trend.dim is "input" or "both", the user can use the trend.pol to specify if the trend on the input space alone should be "linear" or "quadratic}. Finally, if \code{trend.dim} is \code{"both"}, then an \code{interaction} term specify the polynomial order (\code{"linear or "quadratic") of the input space trend that is multiplied to the fidelity space trend. See regF_gen for further details.

mean.known

Specifies the mean if "SK" as trend.type, scalar.

H.known

allow the user to specify the value of H as H.known, a scalar in (0,1).

gradient

whether or not the gradient of the log-likelihood shouldbe used in the parameter estimation.

init

Where should the parameter estimation start from, a vector.

single_fidelity

can be used as TRUE to use MuFiMeshGP as a single fidelity Gaussian Process. This will set sigma2sq as 0.

param.bounds

a list with two arguments(lower and upper) describing the bounds used for MLE optimization of phi1sq and phi2sq. Each argument should be a vector of length ncol(X). If NULL the bounds of phi1sq and phi2sq are specified automatically from the design matrix.

iso

whether the covariance function will be isotropic (TRUE or FALSE)

l

rate of convergence of the system (see Details), scalar.

nugget

(optional) for controlling numerical error.

ncores

(optional) number of cores for parallelization.

Details

From the model fitted by MuFiMeshGP or update.MuFiMeshGP the posterior mean and standard deviation are calculated for any input location and fidelity level. For details, see Boutelet and Sung (2025, <arXiv:2503.23158>).

Value

a list which is given the S3 class "MuFiMeshGP"

See Also

MuFiMeshGP for the model.

Examples

# Example code

f <- function(x, t){
  x <- c(x)
  return(exp(-1.4*x)*cos(3.5*pi*x)+sin(40*x)/10*t^2)
}

set.seed(1)
X <- matrix(runif(15,0,1), ncol = 1)
tt <- runif(15,0.5,2)

Y <- f(c(X), tt)

fit.mufimeshgp <- MuFiMeshGP(X, tt, Y)

xx <- matrix(seq(0,1,0.01), ncol = 1)
ftrue <- f(xx, 0)

# predict
pred.mufimeshgp <- predict(fit.mufimeshgp, xx, rep(0,101))

mu <- pred.mufimeshgp$mean
s <- pred.mufimeshgp$sd
lower <- mu + qnorm(0.025)*s
upper <- mu + qnorm(0.975)*s

# plot

oldpar <- par(mfrow = c(1,1))
plot(xx, ftrue, "l", ylim = c(-1,1.3), ylab = "y", xlab = "x")
lines(c(xx), mu, col = "blue")
lines(c(xx), lower, col = "blue", lty = 2)
lines(c(xx), upper, col = "blue", lty = 2)
points(c(X), Y, col = "red")
par(oldpar)

### RMSE ###
print(sqrt(mean((ftrue - mu))^2))


MuFiMeshGP documentation built on Sept. 1, 2025, 5:09 p.m.