class GaussianKernel¶
- class deeptime.kernels.GaussianKernel(sigma, impl='cdist')¶
Implementation of the Gaussian kernel
\[\kappa (x,y) = \exp \left(-\sum_k (x_k - y_k)^2 / (2\sigma^2)\right),\]where \(\sigma\) is the bandwidth of the kernel.
- Parameters:
sigma (float) – The bandwidth.
Attributes
impl
Bandwidth of the Gaussian kernel.
Valid implementation modes.
Methods
apply
(data_1, data_2)Applies the kernel to data arrays.
gram
(data)Computes the corresponding Gram matrix, see also
apply()
.- __call__(x, y)¶
Computes the value of the kernel at two specific points.
- Parameters:
x ((d,) ndarray) – X point.
y ((d,) ndarray) – Y point.
- Returns:
kxy – The kernel evaluation \(\kappa (x, y)\).
- Return type:
float
Notes
This dispatches to
_evaluate()
which is an interface method intended to be overridden by a specific kernel implementation.
- apply(data_1: ndarray, data_2: ndarray) ndarray ¶
Applies the kernel to data arrays.
Given \(x\in\mathbb{R}^{T_1 \times d}\) and \(y\in\mathbb{R}^{T_2\times d}\), it yields a kernel matrix
\[K = (\kappa(x_i, y_j))_{i,j}\in\mathbb{R}^{T_1\times T_2}.\]Note that this corresponds to the kernel Gramian in case \(x = y\).
- Parameters:
data_1 ((T_1, d) ndarray) – Data array.
data_2 ((T_2, d) ndarray) – Data array.
- Returns:
K – The kernel matrix.
- Return type:
(T_1, T_2) ndarray
- gram(data: ndarray) ndarray ¶
Computes the corresponding Gram matrix, see also
apply()
.- Parameters:
data ((T, d) ndarray) – The data array.
- Returns:
G – The kernel Gramian with
G[i, j] = k(x[i], x[j])
.- Return type:
(T, T) ndarray
- property sigma: ndarray¶
Bandwidth of the Gaussian kernel.
- Getter:
Yields the bandwidth.
- Type:
(1,) ndarray
- valid_impls = ('cdist', 'binomial')¶
Valid implementation modes.