GauPro_base | R Documentation |
Class providing object with methods for fitting a GP model
Class providing object with methods for fitting a GP model
R6Class
object.
Object of R6Class
with methods for fitting GP model.
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 X
and Z
as 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.
X
Design matrix
Z
Responses
N
Number of data points
D
Dimension of data
nug.min
Minimum value of nugget
nug
Value of the nugget, is estimated unless told otherwise
verbose
0 means nothing printed, 1 prints some, 2 prints most.
useGrad
Should grad be used?
useC
Should C code be used?
parallel
Should the code be run in parallel?
parallel_cores
How many cores are there? It will self detect, do not set yourself.
nug.est
Should the nugget be estimated?
param.est
Should the parameters be estimated?
mu_hat
Mean estimate
s2_hat
Variance estimate
K
Covariance matrix
Kchol
Cholesky factorization of K
Kinv
Inverse of K
corr_func()
Correlation function
GauPro_base$corr_func(...)
...
Does nothing
new()
Create GauPro object
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, ... )
X
Matrix whose rows are the input points
Z
Output points corresponding to X
verbose
Amount of stuff to print. 0 is little, 2 is a lot.
useC
Should C code be used when possible? Should be faster.
useGrad
Should the gradient be used?
parallel
Should code be run in parallel? Make optimization faster but uses more computer resources.
nug
Value for the nugget. The starting value if estimating it.
nug.min
Minimum allowable value for the nugget.
nug.est
Should the nugget be estimated?
param.est
Should the kernel parameters be estimated?
...
Not used
initialize_GauPr()
Not used
GauPro_base$initialize_GauPr()
fit()
Fit the model, never use this function
GauPro_base$fit(X, Z)
X
Not used
Z
Not used
update_K_and_estimates()
Update Covariance matrix and estimated parameters
GauPro_base$update_K_and_estimates()
predict()
Predict mean and se for given matrix
GauPro_base$predict(XX, se.fit = F, covmat = F, split_speed = T)
XX
Points to predict at
se.fit
Should the se be returned?
covmat
Should the covariance matrix be returned?
split_speed
Should the predictions be split up for speed
pred()
Predict mean and se for given matrix
GauPro_base$pred(XX, se.fit = F, covmat = F, split_speed = T)
XX
Points to predict at
se.fit
Should the se be returned?
covmat
Should the covariance matrix be returned?
split_speed
Should the predictions be split up for speed
pred_one_matrix()
Predict mean and se for given matrix
GauPro_base$pred_one_matrix(XX, se.fit = F, covmat = F)
XX
Points to predict at
se.fit
Should the se be returned?
covmat
Should the covariance matrix be returned?
pred_mean()
Predict mean
GauPro_base$pred_mean(XX, kx.xx)
XX
Points to predict at
kx.xx
Covariance matrix between X and XX
pred_meanC()
Predict mean using C code
GauPro_base$pred_meanC(XX, kx.xx)
XX
Points to predict at
kx.xx
Covariance matrix between X and XX
pred_var()
Predict variance
GauPro_base$pred_var(XX, kxx, kx.xx, covmat = F)
XX
Points to predict at
kxx
Covariance matrix of XX with itself
kx.xx
Covariance matrix between X and XX
covmat
Not used
pred_LOO()
Predict at X using leave-one-out. Can use for diagnostics.
GauPro_base$pred_LOO(se.fit = FALSE)
se.fit
Should the standard error and t values be returned?
plot()
Plot the object
GauPro_base$plot(...)
...
Parameters passed to cool1Dplot(), plot2D(), or plotmarginal()
cool1Dplot()
Make cool 1D plot
GauPro_base$cool1Dplot( n2 = 20, nn = 201, col2 = "gray", xlab = "x", ylab = "y", xmin = NULL, xmax = NULL, ymin = NULL, ymax = NULL )
n2
Number of things to plot
nn
Number of things to plot
col2
color
xlab
x label
ylab
y label
xmin
xmin
xmax
xmax
ymin
ymin
ymax
ymax
plot1D()
Make 1D plot
GauPro_base$plot1D( n2 = 20, nn = 201, col2 = 2, xlab = "x", ylab = "y", xmin = NULL, xmax = NULL, ymin = NULL, ymax = NULL )
n2
Number of things to plot
nn
Number of things to plot
col2
Color of the prediction interval
xlab
x label
ylab
y label
xmin
xmin
xmax
xmax
ymin
ymin
ymax
ymax
plot2D()
Make 2D plot
GauPro_base$plot2D()
loglikelihood()
Calculate the log likelihood, don't use this
GauPro_base$loglikelihood(mu = self$mu_hat, s2 = self$s2_hat)
mu
Mean vector
s2
s2 param
optim()
Optimize parameters
GauPro_base$optim( restarts = 5, param_update = T, nug.update = self$nug.est, parallel = self$parallel, parallel_cores = self$parallel_cores )
restarts
Number of restarts to do
param_update
Should parameters be updated?
nug.update
Should nugget be updated?
parallel
Should restarts be done in parallel?
parallel_cores
If running parallel, how many cores should be used?
optimRestart()
Run a single optimization restart.
GauPro_base$optimRestart( start.par, start.par0, param_update, nug.update, optim.func, optim.grad, optim.fngr, lower, upper, jit = T )
start.par
Starting parameters
start.par0
Starting parameters
param_update
Should parameters be updated?
nug.update
Should nugget be updated?
optim.func
Function to optimize.
optim.grad
Gradient of function to optimize.
optim.fngr
Function that returns the function value and its gradient.
lower
Lower bounds for optimization
upper
Upper bounds for optimization
jit
Is jitter being used?
update()
Update the model, can be data and parameters
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 )
Xnew
New X matrix
Znew
New Z values
Xall
Matrix with all X values
Zall
All Z values
restarts
Number of optimization restarts
param_update
Should the parameters be updated?
nug.update
Should the nugget be updated?
no_update
Should none of the parameters/nugget be updated?
update_data()
Update the data
GauPro_base$update_data(Xnew = NULL, Znew = NULL, Xall = NULL, Zall = NULL)
Xnew
New X matrix
Znew
New Z values
Xall
Matrix with all X values
Zall
All Z values
update_corrparams()
Update the correlation parameters
GauPro_base$update_corrparams(...)
...
Args passed to update
update_nugget()
Update the nugget
GauPro_base$update_nugget(...)
...
Args passed to update
deviance_searchnug()
Optimize deviance for nugget
GauPro_base$deviance_searchnug()
nugget_update()
Update the nugget
GauPro_base$nugget_update()
grad_norm()
Calculate the norm of the gradient at XX
GauPro_base$grad_norm(XX)
XX
Points to calculate at
sample()
Sample at XX
GauPro_base$sample(XX, n = 1)
XX
Input points to sample at
n
Number of samples
print()
Print object
GauPro_base$print()
clone()
The objects of this class are cloneable with this method.
GauPro_base$clone(deep = FALSE)
deep
Whether to make a deep clone.
#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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.