The Kernel interface¶
-
class
mklaren.kernel.kinterface.Kinterface(data, kernel, kernel_args={}, data_labels=None, row_normalize=False)¶ Interface to invoke kernels. Acts as a wrapper for a unified use of kernel functions/matrices by implementing
__getitem__and__call__.Required for methods that only require access to parts of the kernel matrix.
-
__call__(x, y)¶ Mimic a callable kernel function.
Parameters: - x – (
numpy.ndarray) Data point. - y – (
numpy.ndarray) Data point.
Returns: (
float) Value of the kernel for x, y.- x – (
-
__getitem__(item)¶ Access portions of the kernel matrix generated by
kernel.Parameters: item – ( tuple) pair of: indices or list of indices or (numpy.ndarray) or (slice) to address portions of the kernel matrix.Returns: ( numpy.ndarray) Value of the kernel matrix for item.
-
diag()¶ Diagonal of the kernel matrix.
\[\mathbf{d}_i = k(\mathbf{x}_i, \mathbf{x}_i)\]:return (
numpy.ndarray) diagonal values of the kernel matrix.
-
diagonal()¶ Diagonal of the kernel matrix (alias).
-