BasisFunctionComputation#

class gpjax.kernels.BasisFunctionComputation[source]#

Bases: AbstractKernelComputation

Compute engine class for finite basis function approximations to a kernel.

compute_features(kernel, x)[source]#

Compute the features for the inputs.

Parameters:
  • kernel (K) – the kernel function.

  • x (Float[jaxlib._jax.Array, 'N D'] | Float[ndarray, 'N D']) – the inputs to the kernel function of shape (N, D).

Returns:

A matrix of shape \(N \times L\) representing the random fourier features where \(L = 2M\).

Return type:

Float[jaxlib._jax.Array, ‘N L’] | Float[ndarray, ‘N L’]

diagonal(kernel, inputs)[source]#

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

Parameters:
  • kernel (AbstractKernel) – the kernel function.

  • inputs (Float[Array, "N D"]) – The input matrix.

Returns:

The computed diagonal variance entries.

Return type:

Diagonal

scaling(kernel)[source]#

Compute the scaling factor for the covariance matrix.

Parameters:

kernel (K) – the kernel function.

Returns:

A scalar array representing the scaling factor.

Return type:

Float[jaxlib._jax.Array, ‘’] | Float[ndarray, ‘’]