Compute the linear kernel (i.e., dot-product) between all pairs of rows in `X` and `Y`. Parameters ---------- X : :py:class:`ndarray ` of shape `(N, C)` Collection of `N` input vectors Y : :py:class:`ndarray
(self, X, Y=None)
| 94 | self.parameters = {"c0": c0} |
| 95 | |
| 96 | def _kernel(self, X, Y=None): |
| 97 | """ |
| 98 | Compute the linear kernel (i.e., dot-product) between all pairs of rows in |
| 99 | `X` and `Y`. |
| 100 | |
| 101 | Parameters |
| 102 | ---------- |
| 103 | X : :py:class:`ndarray <numpy.ndarray>` of shape `(N, C)` |
| 104 | Collection of `N` input vectors |
| 105 | Y : :py:class:`ndarray <numpy.ndarray>` of shape `(M, C)` or None |
| 106 | Collection of `M` input vectors. If None, assume `Y` = `X`. |
| 107 | Default is None. |
| 108 | |
| 109 | Returns |
| 110 | ------- |
| 111 | out : :py:class:`ndarray <numpy.ndarray>` of shape `(N, M)` |
| 112 | Similarity between `X` and `Y`, where index (`i`, `j`) gives |
| 113 | :math:`k(x_i, y_j)`. |
| 114 | """ |
| 115 | X, Y = kernel_checks(X, Y) |
| 116 | return X @ Y.T + self.parameters["c0"] |
| 117 | |
| 118 | |
| 119 | class PolynomialKernel(KernelBase): |
nothing calls this directly
no test coverage detected