Periodic: Periodic Kernel R6 class

PeriodicR Documentation

Periodic Kernel R6 class

Description

Periodic Kernel R6 class

Periodic Kernel R6 class

Format

R6Class object.

Details

p is the period for each dimension, a is a single number for scaling

Value

Object of R6Class with methods for fitting GP model.

Super class

GauPro::GauPro_kernel -> GauPro_kernel_Periodic

Public fields

p

Parameter for correlation

p_est

Should p be estimated?

logp

Log of p

logp_lower

Lower bound of logp

logp_upper

Upper bound of logp

p_length

length of p

alpha

Parameter for correlation

alpha_est

Should alpha be estimated?

logalpha

Log of alpha

logalpha_lower

Lower bound of logalpha

logalpha_upper

Upper bound of logalpha

s2

variance

s2_est

Is s2 estimated?

logs2

Log of s2

logs2_lower

Lower bound of logs2

logs2_upper

Upper 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
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.


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
x

vector.

y

vector, optional. If excluded, find correlation of x with itself.

logp

Correlation parameters.

logalpha

Correlation parameters.

s2

Variance parameter.

params

parameters to use instead of beta and s2.


Method kone()

Find covariance of two points

Usage
Periodic$kone(x, y, logp, p, alpha, s2)
Arguments
x

vector

y

vector

logp

correlation parameters on log scale

p

correlation parameters on regular scale

alpha

correlation parameter

s2

Variance parameter


Method dC_dparams()

Derivative of covariance with respect to parameters

Usage
Periodic$dC_dparams(params = NULL, X, C_nonug, C, nug)
Arguments
params

Kernel parameters

X

matrix of points in rows

C_nonug

Covariance without nugget added to diagonal

C

Covariance with nugget

nug

Value 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
params

Kernel parameters

X

matrix of points in rows

nug

Value 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
XX

matrix of points

X

matrix of points to take derivative with respect to

logp

log of p

logalpha

log of alpha

s2

Variance 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
jitter

Should there be a jitter?

y

Output

p_est

Is p being estimated?

alpha_est

Is alpha being estimated?

s2_est

Is 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
jitter

Should there be a jitter?

y

Output

p_est

Is p being estimated?

alpha_est

Is alpha being estimated?

s2_est

Is 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_est

Is p being estimated?

alpha_est

Is alpha being estimated?

s2_est

Is 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_est

Is p being estimated?

alpha_est

Is alpha being estimated?

s2_est

Is 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_out

Output from optimization

p_est

Is p being estimated?

alpha_est

Is alpha being estimated?

s2_est

Is s2 being estimated?


Method s2_from_params()

Get s2 from params vector

Usage
Periodic$s2_from_params(params, s2_est = self$s2_est)
Arguments
params

parameter vector

s2_est

Is 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
deep

Whether 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)

GauPro documentation built on April 11, 2023, 6:06 p.m.