kernel_linear#

mvpy.math.kernel_linear(x: ndarray | Tensor, y: ndarray | Tensor, *args: Any) ndarray | Tensor[source]#

Compute the linear kernel function.

Parameters:
xUnion[np.ndarray, torch.Tensor]

Matrix x of shape (n_samples, n_features).

yUnion[np.ndarray, torch.Tensor]

Matrix y of shape (n_samples, n_features).

Returns:
kUnion[np.ndarray, torch.Tensor]

Kernel matrix of shape (n_samples, n_samples).

Notes

The linear kernel is computed as:

\[\kappa(x, y) = x y^T\]

Note that, unlike other math functions, this is specifically for 2D inputs and outputs.