Skip to contents

Kernel R6 class

Kernel R6 class

Usage

k_IgnoreIndsKernel(k, ignoreinds, useC = TRUE)

Format

R6Class object.

Arguments

k

Kernel to use on the non-ignored indices

ignoreinds

Indices of columns of X to ignore.

useC

Should C code used? Not implemented for IgnoreInds.

Value

Object of R6Class with methods for fitting GP model.

Super class

GauPro::GauPro_kernel -> GauPro_kernel_IgnoreInds

Public fields

D

Number of input dimensions of data

kernel

Kernel to use on indices that aren't ignored

ignoreinds

Indices to ignore. For a matrix X, these are the columns to ignore. For example, when those dimensions will be given a different kernel, such as for factors.

Active bindings

s2_est

Is s2 being estimated?

s2

Value of s2 (variance)

Methods

Inherited methods


Method new()

Initialize kernel object

Usage

IgnoreIndsKernel$new(k, ignoreinds, useC = TRUE)

Arguments

k

Kernel to use on the non-ignored indices

ignoreinds

Indices of columns of X to ignore.

useC

Should C code used? Not implemented for IgnoreInds.


Method k()

Calculate covariance between two points

Usage

IgnoreIndsKernel$k(x, y = NULL, ...)

Arguments

x

vector.

y

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

...

Passed to kernel


Method kone()

Find covariance of two points

Usage

IgnoreIndsKernel$kone(x, y, ...)

Arguments

x

vector

y

vector

...

Passed to kernel


Method dC_dparams()

Derivative of covariance with respect to parameters

Usage

IgnoreIndsKernel$dC_dparams(params = NULL, X, ...)

Arguments

params

Kernel parameters

X

matrix of points in rows

...

Passed to kernel


Method C_dC_dparams()

Calculate covariance matrix and its derivative with respect to parameters

Usage

IgnoreIndsKernel$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

IgnoreIndsKernel$dC_dx(XX, X, ...)

Arguments

XX

matrix of points

X

matrix of points to take derivative with respect to

...

Additional arguments passed on to the kernel


Method param_optim_start()

Starting point for parameters for optimization

Usage

IgnoreIndsKernel$param_optim_start(...)

Arguments

...

Passed to kernel


Method param_optim_start0()

Starting point for parameters for optimization

Usage

IgnoreIndsKernel$param_optim_start0(...)

Arguments

...

Passed to kernel


Method param_optim_lower()

Lower bounds of parameters for optimization

Usage

IgnoreIndsKernel$param_optim_lower(...)

Arguments

...

Passed to kernel


Method param_optim_upper()

Upper bounds of parameters for optimization

Usage

IgnoreIndsKernel$param_optim_upper(...)

Arguments

...

Passed to kernel


Method set_params_from_optim()

Set parameters from optimization output

Usage

IgnoreIndsKernel$set_params_from_optim(...)

Arguments

...

Passed to kernel


Method s2_from_params()

Get s2 from params vector

Usage

IgnoreIndsKernel$s2_from_params(...)

Arguments

...

Passed to kernel


Method print()

Print this object

Usage

IgnoreIndsKernel$print()


Method clone()

The objects of this class are cloneable with this method.

Usage

IgnoreIndsKernel$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

kg <- Gaussian$new(D=3)
kig <- GauPro::IgnoreIndsKernel$new(k = Gaussian$new(D=3), ignoreinds = 2)
Xtmp <- as.matrix(expand.grid(1:2, 1:2, 1:2))
cbind(Xtmp, kig$k(Xtmp))
#>      Var1 Var2 Var3                                                            
#> [1,]    1    1    1 1.0000000 0.3678794 1.0000000 0.3678794 0.3678794 0.1353353
#> [2,]    2    1    1 0.3678794 1.0000000 0.3678794 1.0000000 0.1353353 0.3678794
#> [3,]    1    2    1 1.0000000 0.3678794 1.0000000 0.3678794 0.3678794 0.1353353
#> [4,]    2    2    1 0.3678794 1.0000000 0.3678794 1.0000000 0.1353353 0.3678794
#> [5,]    1    1    2 0.3678794 0.1353353 0.3678794 0.1353353 1.0000000 0.3678794
#> [6,]    2    1    2 0.1353353 0.3678794 0.1353353 0.3678794 0.3678794 1.0000000
#> [7,]    1    2    2 0.3678794 0.1353353 0.3678794 0.1353353 1.0000000 0.3678794
#> [8,]    2    2    2 0.1353353 0.3678794 0.1353353 0.3678794 0.3678794 1.0000000
#>                         
#> [1,] 0.3678794 0.1353353
#> [2,] 0.1353353 0.3678794
#> [3,] 0.3678794 0.1353353
#> [4,] 0.1353353 0.3678794
#> [5,] 1.0000000 0.3678794
#> [6,] 0.3678794 1.0000000
#> [7,] 1.0000000 0.3678794
#> [8,] 0.3678794 1.0000000
cbind(Xtmp, kg$k(Xtmp))
#>      Var1 Var2 Var3                                                       
#> [1,]    1    1    1 1.00000000 0.36787944 0.36787944 0.13533528 0.36787944
#> [2,]    2    1    1 0.36787944 1.00000000 0.13533528 0.36787944 0.13533528
#> [3,]    1    2    1 0.36787944 0.13533528 1.00000000 0.36787944 0.13533528
#> [4,]    2    2    1 0.13533528 0.36787944 0.36787944 1.00000000 0.04978707
#> [5,]    1    1    2 0.36787944 0.13533528 0.13533528 0.04978707 1.00000000
#> [6,]    2    1    2 0.13533528 0.36787944 0.04978707 0.13533528 0.36787944
#> [7,]    1    2    2 0.13533528 0.04978707 0.36787944 0.13533528 0.36787944
#> [8,]    2    2    2 0.04978707 0.13533528 0.13533528 0.36787944 0.13533528
#>                                      
#> [1,] 0.13533528 0.13533528 0.04978707
#> [2,] 0.36787944 0.04978707 0.13533528
#> [3,] 0.04978707 0.36787944 0.13533528
#> [4,] 0.13533528 0.13533528 0.36787944
#> [5,] 0.36787944 0.36787944 0.13533528
#> [6,] 1.00000000 0.13533528 0.36787944
#> [7,] 0.13533528 1.00000000 0.36787944
#> [8,] 0.36787944 0.36787944 1.00000000