Skip to content

Base

gpjax.kernels.computations.base

Kernel = tp.TypeVar('Kernel', bound='gpjax.kernels.base.AbstractKernel') module-attribute
AbstractKernelComputation dataclass

Abstract class for kernel computations.

__init__() -> None
gram(kernel: Kernel, x: Num[Array, 'N D']) -> LinearOperator

Compute Gram covariance operator of the kernel function.

Parameters:

Name Type Description Default
kernel AbstractKernel

the kernel function.

required
x Num[Array, 'N N']

The inputs to the kernel function.

required
Returns
LinearOperator: Gram covariance operator of the kernel function.
cross_covariance(kernel: Kernel, x: Num[Array, 'N D'], y: Num[Array, 'M D']) -> Float[Array, 'N M'] abstractmethod

For a given kernel, compute the NxM gram matrix on an a pair of input matrices with shape NxD and MxD.

Parameters:

Name Type Description Default
kernel AbstractKernel

the kernel function.

required
x Num[Array, 'N D']

The first input matrix.

required
y Num[Array, 'M D']

The second input matrix.

required
Returns
Float[Array, "N M"]: The computed cross-covariance.
diagonal(kernel: Kernel, inputs: Num[Array, 'N D']) -> Diagonal

For a given kernel, compute the elementwise diagonal of the NxN gram matrix on an input matrix of shape NxD.

Parameters:

Name Type Description Default
kernel AbstractKernel

the kernel function.

required
inputs Float[Array, 'N D']

The input matrix.

required
Returns
Diagonal: The computed diagonal variance entries.