Skip to content

Base

MultiOutputKernel

MultiOutputKernel(
    active_dims: Union[list[int], slice, None] = None,
    n_dims: Union[int, None] = None,
    compute_engine: AbstractKernelComputation = DenseKernelComputation(),
)

Bases: AbstractKernel

Base class for multi-output kernels.

Multi-output kernels produce structured covariance matrices (Kronecker, BlockDiag, etc.) over the joint input-output space. They do not support point-pair evaluation via call; all computation goes through the compute engine's gram() and cross_covariance() methods.

Parameters:

  • active_dims (Union[list[int], slice, None], default: None ) –

    the indices of the input dimensions that are active in the kernel's evaluation, represented by a list of integers or a slice object. Defaults to a full slice.

  • n_dims (Union[int, None], default: None ) –

    the number of input dimensions of the kernel.

  • compute_engine (AbstractKernelComputation, default: DenseKernelComputation() ) –

    the computation engine that is used to compute the kernel's cross-covariance and gram matrices. Defaults to DenseKernelComputation.

num_outputs abstractmethod property

num_outputs: int

Number of output dimensions.

num_latent_gps abstractmethod property

num_latent_gps: int

Number of latent GP functions.

latent_kernels abstractmethod property

latent_kernels: tuple[AbstractKernel, ...]

Tuple of latent kernels.

components abstractmethod property

components: tuple[
    tuple[CoregionalizationMatrix, AbstractKernel], ...
]

Paired (coregionalization_matrix, kernel) components.

cross_covariance

cross_covariance(
    x: Num[Array, "N D"], y: Num[Array, "M D"]
) -> Float[Array, ...]

Cross-covariance for multi-output kernels.

Returns shape [NP, MP] where P is num_outputs — overrides the single-output [N, M] annotation.

gram

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

Compute the gram matrix of the kernel.

Parameters:

  • x (Num[Array, 'N D']) –

    the input matrix of shape (N, D).

Returns:

  • LinearOperator –

    The gram matrix of the kernel of shape (N, N).

diagonal

diagonal(x: Num[Array, 'N D']) -> LinearOperator

Compute the diagonal of the gram matrix of the kernel.

Parameters:

  • x (Num[Array, 'N D']) –

    the input matrix of shape (N, D).

Returns:

  • LinearOperator –

    The diagonal of the gram matrix of the kernel of shape (N,).

slice_input

slice_input(
    x: Float[Array, "... D"],
) -> Float[Array, "... Q"]

Slice out the relevant columns of the input matrix.

Select the relevant columns of the supplied matrix to be used within the kernel's evaluation.

Parameters:

  • x (Float[Array, '... D']) –

    the matrix or vector that is to be sliced.

Returns:

  • Float[Array, '... Q'] –

    The sliced form of the input matrix.

__add__

__add__(
    other: Union[AbstractKernel, ScalarFloat],
) -> AbstractKernel

Add two kernels together. Args: other (AbstractKernel): The kernel to be added to the current kernel.

Returns:

  • AbstractKernel ( AbstractKernel ) –

    A new kernel that is the sum of the two kernels.

__mul__

__mul__(
    other: Union[AbstractKernel, ScalarFloat],
) -> AbstractKernel

Multiply two kernels together.

Parameters:

  • other (AbstractKernel) –

    The kernel to be multiplied with the current kernel.

Returns:

  • AbstractKernel ( AbstractKernel ) –

    A new kernel that is the product of the two kernels.