Skip to content

Diagonal

gpjax.kernels.computations.diagonal

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

Bases: AbstractKernelComputation

Diagonal kernel computation class. Operations with the kernel assume a diagonal Gram matrix.

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
gram(kernel: Kernel, x: Float[Array, 'N D']) -> LinearOperator

Compute the Gram matrix.

For a kernel with diagonal structure, compute the NΓ—NN\times N Gram matrix on an input matrix of shape NΓ—DN\times D.

Parameters:

Name Type Description Default
kernel Kernel

the kernel function.

required
x Float[Array, 'N D']

The input matrix.

required
Returns
LinearOperator: The computed square Gram matrix.
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 NΓ—MN\times M covariance matrix on a pair of input matrices of shape NΓ—DN\times D and MΓ—DM\times D.

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.