| Periodic {GauPro} | R Documentation |
Periodic Kernel R6 class
Description
Periodic Kernel R6 class
Periodic Kernel R6 class
Usage
k_Periodic(
p,
alpha = 1,
s2 = 1,
D,
p_lower = 0,
p_upper = 100,
p_est = TRUE,
alpha_lower = 0,
alpha_upper = 100,
alpha_est = TRUE,
s2_lower = 1e-08,
s2_upper = 1e+08,
s2_est = TRUE,
useC = TRUE
)
Arguments
p |
Periodic parameter |
alpha |
Periodic parameter |
s2 |
Initial variance |
D |
Number of input dimensions of data |
p_lower |
Lower bound for p |
p_upper |
Upper bound for p |
p_est |
Should p be estimated? |
alpha_lower |
Lower bound for alpha |
alpha_upper |
Upper bound for alpha |
alpha_est |
Should alpha be estimated? |
s2_lower |
Lower bound for s2 |
s2_upper |
Upper bound for s2 |
s2_est |
Should s2 be estimated? |
useC |
Should C code used? Much faster if implemented. |
Format
R6Class object.
Details
p is the period for each dimension, a is a single number for scaling
k(x, y) = s2 * exp(-sum(alpha*sin(p * (x-y))^2))
k(x, y) = \sigma^2 * \exp(-\sum(\alpha_i*sin(p * (x_i-y_i))^2))
Value
Object of R6Class with methods for fitting GP model.
Super class
GauPro::GauPro_kernel -> GauPro_kernel_Periodic
Public fields
pParameter for correlation
p_estShould p be estimated?
logpLog of p
logp_lowerLower bound of logp
logp_upperUpper bound of logp
p_lengthlength of p
alphaParameter for correlation
alpha_estShould alpha be estimated?
logalphaLog of alpha
logalpha_lowerLower bound of logalpha
logalpha_upperUpper bound of logalpha
s2variance
s2_estIs s2 estimated?
logs2Log of s2
logs2_lowerLower bound of logs2
logs2_upperUpper bound of logs2
Methods
Public methods
Inherited methods
Method new()
Initialize kernel object
Usage
Periodic$new( p, alpha = 1, s2 = 1, D, p_lower = 0, p_upper = 100, p_est = TRUE, alpha_lower = 0, alpha_upper = 100, alpha_est = TRUE, s2_lower = 1e-08, s2_upper = 1e+08, s2_est = TRUE, useC = TRUE )
Arguments
pPeriodic parameter
alphaPeriodic parameter
s2Initial variance
DNumber of input dimensions of data
p_lowerLower bound for p
p_upperUpper bound for p
p_estShould p be estimated?
alpha_lowerLower bound for alpha
alpha_upperUpper bound for alpha
alpha_estShould alpha be estimated?
s2_lowerLower bound for s2
s2_upperUpper bound for s2
s2_estShould s2 be estimated?
useCShould C code used? Much faster if implemented.
Method k()
Calculate covariance between two points
Usage
Periodic$k( x, y = NULL, logp = self$logp, logalpha = self$logalpha, s2 = self$s2, params = NULL )
Arguments
xvector.
yvector, optional. If excluded, find correlation of x with itself.
logpCorrelation parameters.
logalphaCorrelation parameters.
s2Variance parameter.
paramsparameters to use instead of beta and s2.
Method kone()
Find covariance of two points
Usage
Periodic$kone(x, y, logp, p, alpha, s2)
Arguments
xvector
yvector
logpcorrelation parameters on log scale
pcorrelation parameters on regular scale
alphacorrelation parameter
s2Variance parameter
Method dC_dparams()
Derivative of covariance with respect to parameters
Usage
Periodic$dC_dparams(params = NULL, X, C_nonug, C, nug)
Arguments
paramsKernel parameters
Xmatrix of points in rows
C_nonugCovariance without nugget added to diagonal
CCovariance with nugget
nugValue of nugget
Method C_dC_dparams()
Calculate covariance matrix and its derivative with respect to parameters
Usage
Periodic$C_dC_dparams(params = NULL, X, nug)
Arguments
paramsKernel parameters
Xmatrix of points in rows
nugValue of nugget
Method dC_dx()
Derivative of covariance with respect to X
Usage
Periodic$dC_dx(XX, X, logp = self$logp, logalpha = self$logalpha, s2 = self$s2)
Arguments
XXmatrix of points
Xmatrix of points to take derivative with respect to
logplog of p
logalphalog of alpha
s2Variance parameter
Method param_optim_start()
Starting point for parameters for optimization
Usage
Periodic$param_optim_start( jitter = F, y, p_est = self$p_est, alpha_est = self$alpha_est, s2_est = self$s2_est )
Arguments
jitterShould there be a jitter?
yOutput
p_estIs p being estimated?
alpha_estIs alpha being estimated?
s2_estIs s2 being estimated?
Method param_optim_start0()
Starting point for parameters for optimization
Usage
Periodic$param_optim_start0( jitter = F, y, p_est = self$p_est, alpha_est = self$alpha_est, s2_est = self$s2_est )
Arguments
jitterShould there be a jitter?
yOutput
p_estIs p being estimated?
alpha_estIs alpha being estimated?
s2_estIs s2 being estimated?
Method param_optim_lower()
Lower bounds of parameters for optimization
Usage
Periodic$param_optim_lower( p_est = self$p_est, alpha_est = self$alpha_est, s2_est = self$s2_est )
Arguments
p_estIs p being estimated?
alpha_estIs alpha being estimated?
s2_estIs s2 being estimated?
Method param_optim_upper()
Upper bounds of parameters for optimization
Usage
Periodic$param_optim_upper( p_est = self$p_est, alpha_est = self$alpha_est, s2_est = self$s2_est )
Arguments
p_estIs p being estimated?
alpha_estIs alpha being estimated?
s2_estIs s2 being estimated?
Method set_params_from_optim()
Set parameters from optimization output
Usage
Periodic$set_params_from_optim( optim_out, p_est = self$p_est, alpha_est = self$alpha_est, s2_est = self$s2_est )
Arguments
optim_outOutput from optimization
p_estIs p being estimated?
alpha_estIs alpha being estimated?
s2_estIs s2 being estimated?
Method s2_from_params()
Get s2 from params vector
Usage
Periodic$s2_from_params(params, s2_est = self$s2_est)
Arguments
paramsparameter vector
s2_estIs s2 being estimated?
Method print()
Print this object
Usage
Periodic$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
Periodic$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
k1 <- Periodic$new(p=1, alpha=1)
plot(k1)
n <- 12
x <- matrix(seq(0,1,length.out = n), ncol=1)
y <- sin(2*pi*x) + rnorm(n,0,1e-1)
gp <- GauPro_kernel_model$new(X=x, Z=y, kernel=Periodic$new(D=1),
parallel=FALSE)
gp$predict(.454)
gp$plot1D()
gp$cool1Dplot()
plot(gp$kernel)