predict_leapGP {leapgp}R Documentation

Predict Method for leapGP

Description

Predict method for an object of class leapGP. Returns a (possibly modified) leapGP object as well as a prediction (with uncertainty, if requested).

Usage

predict_leapGP(
  object,
  newdata,
  rho = 0.95,
  scale = FALSE,
  n = ceiling(sqrt(length(y))),
  start = NA,
  M_max = Inf,
  ...
)

Arguments

object

An object of class leapGP

newdata

New data

rho

parameter controlling time-accuracy tradeoff (default is rho=0.95)

scale

logical. Do we want the scale parameter to be returned for predictions? If TRUE, the matrix K^{-1} will be stored for each hub.

n

local neighborhood size

start

number of starting points for neighborhood (between 6 and n inclusive)

M_max

the maximum number of hubs allowed (used to upper bound the run time)

...

optional arguments to be passed to laGP()

Details

The leapGP is extends the laGP framework of Gramacy & Apley (2015). The methods are equivalent for rho=1, but leapGP trades memory for speed when rho < 1. The method is described in Rumsey et al. (2023) where they demonstrate that leapGP is faster than laGP for sequential predictions and is also generally more accurate for some settings of rho.

Value

A list containing values mean, hubs X and y. If scale=TRUE the list also contains field sd.

References

Gramacy, R. B., & Apley, D. W. (2015). Local Gaussian process approximation for large computer experiments. Journal of Computational and Graphical Statistics, 24(2), 561-578.

Rumsey, K. N., Huerta, G., & Derek Tucker, J. (2023). A localized ensemble of approximate Gaussian processes for fast sequential emulation. Stat, 12(1), e576.

Examples

# Generate data
f <- function(x){
   1.3356*(1.5*(1-x[1]) + exp(2*x[1] - 1)*sin(3*pi*(x[1] - 0.6)^2) +
   exp(3*(x[2]-0.5))*sin(4*pi*(x[2] - 0.9)^2))
}
X <- matrix(runif(200), ncol=2)
y <- apply(X, 1, f)

# Generate data for prediction
Xtest <- matrix(runif(200), ncol=2)
ytest <- apply(Xtest, 1, f)

# Train initial model
mod <- leapGP(X, y, M0 = 30)
# Make sequential predictions
pred <- rep(NA, 100)
for(i in 1:100){
  mod <- predict_leapGP(mod, matrix(Xtest[i,], nrow=1), rho=0.9)
  pred[i] <- mod$mean
}

[Package leapgp version 1.0.0 Index]