| GauPro_base {GauPro} | R Documentation |
Class providing object with methods for fitting a GP model
Description
Class providing object with methods for fitting a GP model
Class providing object with methods for fitting a GP model
Format
R6Class object.
Value
Object of R6Class with methods for fitting GP model.
Methods
new(X, Z, corr="Gauss", verbose=0, separable=T, useC=F,useGrad=T, parallel=T, nug.est=T, ...)This method is used to create object of this class with
XandZas the data.update(Xnew=NULL, Znew=NULL, Xall=NULL, Zall=NULL, restarts = 5, param_update = T, nug.update = self$nug.est)This method updates the model, adding new data if given, then running optimization again.
Public fields
XDesign matrix
ZResponses
NNumber of data points
DDimension of data
nug.minMinimum value of nugget
nugValue of the nugget, is estimated unless told otherwise
verbose0 means nothing printed, 1 prints some, 2 prints most.
useGradShould grad be used?
useCShould C code be used?
parallelShould the code be run in parallel?
parallel_coresHow many cores are there? It will self detect, do not set yourself.
nug.estShould the nugget be estimated?
param.estShould the parameters be estimated?
mu_hatMean estimate
s2_hatVariance estimate
KCovariance matrix
KcholCholesky factorization of K
KinvInverse of K
Methods
Public methods
Method corr_func()
Correlation function
Usage
GauPro_base$corr_func(...)
Arguments
...Does nothing
Method new()
Create GauPro object
Usage
GauPro_base$new( X, Z, verbose = 0, useC = F, useGrad = T, parallel = FALSE, nug = 1e-06, nug.min = 1e-08, nug.est = T, param.est = TRUE, ... )
Arguments
XMatrix whose rows are the input points
ZOutput points corresponding to X
verboseAmount of stuff to print. 0 is little, 2 is a lot.
useCShould C code be used when possible? Should be faster.
useGradShould the gradient be used?
parallelShould code be run in parallel? Make optimization faster but uses more computer resources.
nugValue for the nugget. The starting value if estimating it.
nug.minMinimum allowable value for the nugget.
nug.estShould the nugget be estimated?
param.estShould the kernel parameters be estimated?
...Not used
Method initialize_GauPr()
Not used
Usage
GauPro_base$initialize_GauPr()
Method fit()
Fit the model, never use this function
Usage
GauPro_base$fit(X, Z)
Arguments
XNot used
ZNot used
Method update_K_and_estimates()
Update Covariance matrix and estimated parameters
Usage
GauPro_base$update_K_and_estimates()
Method predict()
Predict mean and se for given matrix
Usage
GauPro_base$predict(XX, se.fit = F, covmat = F, split_speed = T)
Arguments
XXPoints to predict at
se.fitShould the se be returned?
covmatShould the covariance matrix be returned?
split_speedShould the predictions be split up for speed
Method pred()
Predict mean and se for given matrix
Usage
GauPro_base$pred(XX, se.fit = F, covmat = F, split_speed = T)
Arguments
XXPoints to predict at
se.fitShould the se be returned?
covmatShould the covariance matrix be returned?
split_speedShould the predictions be split up for speed
Method pred_one_matrix()
Predict mean and se for given matrix
Usage
GauPro_base$pred_one_matrix(XX, se.fit = F, covmat = F)
Arguments
XXPoints to predict at
se.fitShould the se be returned?
covmatShould the covariance matrix be returned?
Method pred_mean()
Predict mean
Usage
GauPro_base$pred_mean(XX, kx.xx)
Arguments
XXPoints to predict at
kx.xxCovariance matrix between X and XX
Method pred_meanC()
Predict mean using C code
Usage
GauPro_base$pred_meanC(XX, kx.xx)
Arguments
XXPoints to predict at
kx.xxCovariance matrix between X and XX
Method pred_var()
Predict variance
Usage
GauPro_base$pred_var(XX, kxx, kx.xx, covmat = F)
Arguments
XXPoints to predict at
kxxCovariance matrix of XX with itself
kx.xxCovariance matrix between X and XX
covmatNot used
Method pred_LOO()
Predict at X using leave-one-out. Can use for diagnostics.
Usage
GauPro_base$pred_LOO(se.fit = FALSE)
Arguments
se.fitShould the standard error and t values be returned?
Method plot()
Plot the object
Usage
GauPro_base$plot(...)
Arguments
...Parameters passed to cool1Dplot(), plot2D(), or plotmarginal()
Method cool1Dplot()
Make cool 1D plot
Usage
GauPro_base$cool1Dplot( n2 = 20, nn = 201, col2 = "gray", xlab = "x", ylab = "y", xmin = NULL, xmax = NULL, ymin = NULL, ymax = NULL )
Arguments
n2Number of things to plot
nnNumber of things to plot
col2color
xlabx label
ylaby label
xminxmin
xmaxxmax
yminymin
ymaxymax
Method plot1D()
Make 1D plot
Usage
GauPro_base$plot1D( n2 = 20, nn = 201, col2 = 2, xlab = "x", ylab = "y", xmin = NULL, xmax = NULL, ymin = NULL, ymax = NULL )
Arguments
n2Number of things to plot
nnNumber of things to plot
col2Color of the prediction interval
xlabx label
ylaby label
xminxmin
xmaxxmax
yminymin
ymaxymax
Method plot2D()
Make 2D plot
Usage
GauPro_base$plot2D()
Method loglikelihood()
Calculate the log likelihood, don't use this
Usage
GauPro_base$loglikelihood(mu = self$mu_hat, s2 = self$s2_hat)
Arguments
muMean vector
s2s2 param
Method optim()
Optimize parameters
Usage
GauPro_base$optim( restarts = 5, param_update = T, nug.update = self$nug.est, parallel = self$parallel, parallel_cores = self$parallel_cores )
Arguments
restartsNumber of restarts to do
param_updateShould parameters be updated?
nug.updateShould nugget be updated?
parallelShould restarts be done in parallel?
parallel_coresIf running parallel, how many cores should be used?
Method optimRestart()
Run a single optimization restart.
Usage
GauPro_base$optimRestart( start.par, start.par0, param_update, nug.update, optim.func, optim.grad, optim.fngr, lower, upper, jit = T )
Arguments
start.parStarting parameters
start.par0Starting parameters
param_updateShould parameters be updated?
nug.updateShould nugget be updated?
optim.funcFunction to optimize.
optim.gradGradient of function to optimize.
optim.fngrFunction that returns the function value and its gradient.
lowerLower bounds for optimization
upperUpper bounds for optimization
jitIs jitter being used?
Method update()
Update the model, can be data and parameters
Usage
GauPro_base$update( Xnew = NULL, Znew = NULL, Xall = NULL, Zall = NULL, restarts = 5, param_update = self$param.est, nug.update = self$nug.est, no_update = FALSE )
Arguments
XnewNew X matrix
ZnewNew Z values
XallMatrix with all X values
ZallAll Z values
restartsNumber of optimization restarts
param_updateShould the parameters be updated?
nug.updateShould the nugget be updated?
no_updateShould none of the parameters/nugget be updated?
Method update_data()
Update the data
Usage
GauPro_base$update_data(Xnew = NULL, Znew = NULL, Xall = NULL, Zall = NULL)
Arguments
XnewNew X matrix
ZnewNew Z values
XallMatrix with all X values
ZallAll Z values
Method update_corrparams()
Update the correlation parameters
Usage
GauPro_base$update_corrparams(...)
Arguments
...Args passed to update
Method update_nugget()
Update the nugget
Usage
GauPro_base$update_nugget(...)
Arguments
...Args passed to update
Method deviance_searchnug()
Optimize deviance for nugget
Usage
GauPro_base$deviance_searchnug()
Method nugget_update()
Update the nugget
Usage
GauPro_base$nugget_update()
Method grad_norm()
Calculate the norm of the gradient at XX
Usage
GauPro_base$grad_norm(XX)
Arguments
XXPoints to calculate at
Method sample()
Sample at XX
Usage
GauPro_base$sample(XX, n = 1)
Arguments
XXInput points to sample at
nNumber of samples
Method print()
Print object
Usage
GauPro_base$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
GauPro_base$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
#n <- 12
#x <- matrix(seq(0,1,length.out = n), ncol=1)
#y <- sin(2*pi*x) + rnorm(n,0,1e-1)
#gp <- GauPro(X=x, Z=y, parallel=FALSE)