knnsvdGP: K-nearest neighbor SVD-Based GP model

View source: R/knnsvdGP.r

knnsvdGPR Documentation

K-nearest neighbor SVD-Based GP model

Description

Fits a K-nearest neighbour SVD-based GP model on a test set X0, training set design and response matrix resp. The local neighbourhood sets consist of nn points which are selected by the Euclidean distance with respect to the test points. See Zhang et al. (2018) for details.This function supports the parallelization via both the R packages "parallel" and the OpenMP library.

Usage

knnsvdGP(design,resp, X0=design, nn=20, nsvd = nn, frac = .95,
         gstart = 0.0001, nstarts = 5,centralize=FALSE, maxit=100,
         errlog = "", nthread = 1, clutype="PSOCK")

Arguments

design

An N by d matrix of N training/design inputs.

resp

An L by N response matrix of design, where L is the length of the time series outputs, N is the number of design points.

X0

An M by d matrix of M test inputs. The localized SVD-based GP models will be fitted on every point (row) of X0. The default value of X0 is design.

nn

The number of neighborhood points selected by the Euclidean distance. the default value is 20.

nsvd

The number of design points closest to the test points on whose response matrix to perform the initial singular value decomposition. The default value is nn.

frac

The threshold in the cumulative percentage criterion to select the number of SVD bases. The default value is 0.95.

gstart

The starting number and upper bound for estimating the nugget parameter. If gstart = sqrt(.Machine$double.eps), the nugget parameter will be fixed at sqrt(.Machine$double.eps), since sqrt(.Machine$double.eps) is the lower bound of the nugget term. The default value is 0.0001.

nstarts

The number of starting points used in the numerical maximization of the posterior density function. The larger nstarts will typically lead to more accurate prediction but longer computational time. The default value is 5.

centralize

If centralize=TRUE the response matrix will be centralized (subtract the mean) before the start of the algorithm. The mean will be added to the predictive mean at the finish of the algorithm. The default value is FALSE.

maxit

Maximum number of iterations in the numerical optimization algorithm for maximizing the posterior density function. The default value is 100.

errlog

The path of a log file that records the errors occur in the process of fitting local SVD-based GP models. If an empty string is provided, no log file will be produced.

nthread

The number of threads (processes) used in parallel execution of this function. nthread=1 implies no parallelization. The default value is 1.

clutype

The type of parallization utilized by this function. If clutype="OMP", it will use the OpenMP parallelization. Otherwise, it indicates the type of cluster in the R package "parallel" . The default value is "PSOCK". Required only if nthread>1.

Value

pmean

An L by M matrix of posterior predicted mean for the response at the test set X0.

ps2

An L by M matrix of posterior predicted variance for the response at the test set X0.

flags

A vector of integers of length M which indicates the status for fitting the local SVD-based GP models for each of the M input points in the test set. The value 0 indicates successful fitting, the value 1 indicates an error in Cholesky decomposition of the correlation matrices, the value 2 indicates an error in SVD of the local response matrix, the value 3 indicates an error in optimizing the nugget term.

Author(s)

Ru Zhang heavenmarshal@gmail.com,

C. Devon Lin devon.lin@queensu.ca,

Pritam Ranjan pritamr@iimidr.ac.in

References

Zhang, R., Lin, C. D. and Ranjan, P. (2018) Local Gaussian Process Model for Large-scale Dynamic Computer Experiments, Journal of Computational and Graphical Statistics,
DOI: 10.1080/10618600.2018.1473778.

See Also

lasvdGP, svdGP.

Examples

library("lhs")
forretal <- function(x,t,shift=1)
{
    par1 <- x[1]*6+4
    par2 <- x[2]*16+4
    par3 <- x[3]*6+1
    t <- t+shift
    y <- (par1*t-2)^2*sin(par2*t-par3)
}
timepoints <- seq(0,1,len=200)
design <- lhs::randomLHS(100,3)
test <- lhs::randomLHS(20,3)

## evaluate the response matrix on the design matrix
resp <- apply(design,1,forretal,timepoints)

nn <- 15
gs <- sqrt(.Machine$double.eps)

## knnsvdGP with mutiple (5) start points for GP model estimation
## It use the R package "parallel" for parallelization
retknnmsp <- knnsvdGP(design,resp,test,nn,frac=.95,gstart=gs,
                      centralize=TRUE,nstarts=5,nthread=2,clutype="PSOCK")

## knnsvdGP with single start point for GP model estimation
## It does not use parallel computation
retknnss <- knnsvdGP(design,resp,test,nn,frac=.95,gstart=gs,
                     centralize=TRUE,nstarts=1,nthread=1)

DynamicGP documentation built on April 12, 2022, 9:06 a.m.