Skip to content

Dense

gpjax.kernels.computations.dense

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

Bases: AbstractKernelComputation

Dense kernel computation class. Operations with the kernel assume a dense gram matrix structure.

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.
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.
__init__() -> None
cross_covariance(kernel: Kernel, x: Float[Array, 'N D'], y: Float[Array, 'M D']) -> Float[Array, 'N M']

Compute the cross-covariance matrix.

For a given kernel, compute the NxM covariance matrix on a pair of input matrices of shape NxDNxD and MxDMxD.

Parameters:

Name Type Description Default
kernel Kernel

the kernel function.

required
x Float[Array, 'N D']

The input matrix.

required
y Float[Array, 'M D']

The input matrix.

required
Returns
Float[Array, "N M"]: The computed cross-covariance.