Basis Functions
BasisFunctionComputation
Bases: AbstractKernelComputation
Compute engine class for finite basis function approximations to a kernel.
diagonal
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
Diagonal: The computed diagonal variance entries.
compute_features
Compute the features for the inputs.
Parameters:
-
kernel(K) –the kernel function.
-
x(Float[Array, 'N D']) –the inputs to the kernel function of shape
(N, D).
Returns:
-
Float[Array, 'N L']–A matrix of shape \(N \times L\) representing the random fourier features where \(L = 2M\).
scaling
Compute the scaling factor for the covariance matrix.
Parameters:
-
kernel(K) –the kernel function.
Returns:
-
Float[Array, '']–A scalar array representing the scaling factor.
gram
For a given kernel, compute Gram covariance operator of the kernel function
on an input matrix of shape (N, D).
Parameters:
-
kernel(K) –the kernel function.
-
x(Num[Array, 'N D']) –the inputs to the kernel function of shape
(N, D).
Returns:
-
Dense–The Gram covariance of the kernel function as a linear operator.
cross_covariance
For a given kernel, compute the cross-covariance matrix on an a pair
of input matrices with shape (N, D) and (M, D).
Parameters:
-
kernel(K) –the kernel function.
-
x(Num[Array, 'N D']) –the first input matrix of shape
(N, D). -
y(Num[Array, 'M D']) –the second input matrix of shape
(M, D).
Returns:
-
Float[Array, 'N M']–The computed cross-covariance of shape
(N, M).