KernelComposed {BKTR} | R Documentation |
R6 class for Composed Kernels
Description
R6 class for Composed Kernels
Super class
BKTR::Kernel
-> KernelComposed
Public fields
name
The kernel's name
parameters
The parameters of the kernel (list of
KernelParameter
)left_kernel
The left kernel to use for composition
right_kernel
The right kernel to use for composition
composition_operation
The operation to use for composition
has_dist_matrix
Identify if the kernel has a distance matrix or not
Methods
Public methods
Inherited methods
Method new()
Create a new KernelComposed
object.
Usage
KernelComposed$new(left_kernel, right_kernel, new_name, composition_operation)
Arguments
left_kernel
Kernel: The left kernel to use for composition
right_kernel
Kernel: The right kernel to use for composition
new_name
String: The name of the composed kernel
composition_operation
CompositionOps: The operation to use for composition
Method core_kernel_fn()
Method to compute the core kernel's covariance matrix
Usage
KernelComposed$core_kernel_fn()
Returns
The core kernel's covariance matrix
Method set_positions()
Method to set the kernel's positions and compute the distance matrix
Usage
KernelComposed$set_positions(positions_df)
Arguments
positions_df
Dataframe: The positions of the points in a dataframe format
Returns
NULL, set the kernel's positions and compute the distance matrix
Method clone()
The objects of this class are cloneable with this method.
Usage
KernelComposed$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Examples
# Create a new locally periodic kernel
k_loc_per <- KernelComposed$new(
left_kernel = KernelSE$new(),
right_kernel = KernelPeriodic$new(),
new_name = 'Locally Periodic Kernel',
composition_operation = CompositionOps$MUL
)
# Set the kernel's positions
positions_df <- data.frame(x=c(-4, 0, 3), y=c(-2, 0, 2))
k_loc_per$set_positions(positions_df)
# Generate the kernel's covariance matrix
k_loc_per$kernel_gen()