I was reading about regression with Gaussian processes and I bumped into kernel functions. These functions can be expressed as inner products in a new feature space $\mathcal{M}$, that is:
$$k(\mathbf{x}, \mathbf{y}) = \langle \phi(\mathbf{x}), \phi(\mathbf{y}) \rangle_{\mathcal{M}}$$
with $\phi$ a feature map from the original $\mathcal{X}$ to the new feature space:
$$\phi: \mathcal{X} \times \mathcal{X} \rightarrow \mathcal{V}$$
Lets take an example of a kernel function, the RBF kernel, which is defined as:
$$\exp\left(-\gamma\lvert \mathbf{x} - \mathbf{y}\rvert^2\right)$$
Is it correct to say that this function measures the similarity of the two vectors $\mathbf{x}$ and $\mathbf{y}$ in the original space and not in the new space, even though the inner product is performed in the new space? I am asking this question because sometimes the cosine similarity, which is related with the inner product in the original space, is used as a similarity measure (where there is no need to transform in a new space).
Finally, are statements such as:
Inner product measures the similarity between two vectors.
misnomers?
I checked Scikit-learn where it is stated that:
- Distance metrics are functions
d(a, b)
such thatd(a, b) < d(a, c)
if objectsa
andb
are considered “more similar” than objectsa
andc
. - Kernels are measures of similarity, i.e.
s(a, b) > s(a, c)
if objectsa
andb
are considered “more similar” than objectsa
andc
.
Is it correct to say that kernels are the inverses of distance metrics? That is lower distance means greater similarity? For Gaussian kernel it is easy to see it (similarity increases when the Euclidean distance decreases). What about other kernels?
Take the linear kernel as an example, which is nothing else than the inner product in the original space. What distance is reduced when the similarity increases? Clearly, the distance can't be Euclidean distance. This can be justified by considering three vectors $\mathbf{a}, \mathbf{b}, \mathbf{c}$ where $\mathbf{b} = 10000\mathbf{c}$.