In order to exploit kernel substitution, we need to be able to construct valid kernel functions. A necessary and sufficient for a function $k(\bold x,\bold x^{\prime})$ to be a valid kernel is that the Gram matrix $\bold K$, whose elements are given by $k(\bold x_n,\bold x_m)$, should be positive semidefinite for all possible choices of the set $\{\bold x_n\}$.
Techniques for Constructing New Kernels
Given valid kernels $k_1(\bold x,\bold x^{\prime})$ and $k_2(\bold x,\bold x^{\prime})$, the following new kernels will also be valid:
$$ \begin{aligned} k(\bold x,\bold x^{\prime})&=ck_1(\bold x,\bold x^{\prime})\\ k(\bold x,\bold x^{\prime})&=f(\bold x)k_1(\bold x,\bold x^{\prime})f(\bold x^{\prime})\\ k(\bold x,\bold x^{\prime})&=q(k_1(\bold x,\bold x^{\prime}))\\ k(\bold x,\bold x^{\prime})&=\exp(k_1(\bold x,\bold x^{\prime}))\\ k(\bold x,\bold x^{\prime})&=k_1(\bold x,\bold x^{\prime})+k_2(\bold x,\bold x^{\prime})\\ k(\bold x,\bold x^{\prime})&=k_1(\bold x,\bold x^{\prime})k_2(\bold x,\bold x^{\prime})\\ k(\bold x,\bold x^{\prime})&=k_3(\bm\phi(\bold x),\bm\phi(\bold x^{\prime}))\\ k(\bold x,\bold x^{\prime})&=\bold x^{\text T}\bold A\bold x^{\prime}\\ k(\bold x,\bold x^{\prime})&=k_a(\bold x_a,\bold x_a^{\prime})+k_b(\bold x_b,\bold x_b^{\prime})\\ k(\bold x,\bold x^{\prime})&=k_a(\bold x_a,\bold x_a^{\prime})k_b(\bold x_b,\bold x_b^{\prime}) \end{aligned} $$
where $c>0$ is a constant, $f(\cdot)$ is any function, $q(\cdot)$ is a polynomial with nonnegative coefficients, $\bm\phi(\bold x)$ is a function from $\bold x$ to $\Bbb R^M$, $k_3(\cdot,\cdot)$ is a valid kernel in $\Bbb R^M$, $\bold A$ is a symmetric positive semidefinite matrix, $\bold x_a$ and $\bold x_b$ are variables (not necessarily disjoint) with $\bold x=(\bold x_a,\bold x_b)$, and $k_a$ and $k_b$ are valid kernel functions over their respective spaces.
Equipped with these properties, we can now embark on the construction of more complex kernels appropriate to specific applications. We require that the kernel $k(\bold x,\bold x^{\prime})$ by symmetric and positive semidefinite and that it expresses the appropriate form of similarity between $\bold x$ and $\bold x^{\prime}$ according to the intended application.
Polynomial kernel
$k(\bold x,\bold x^{\prime})=(\bold x^{\text T}\bold x^{\prime}+c)^M$ with $c\geqslant0$
Gaussian kernel
$k(\bold x,\bold x^{\prime})=\exp\{-\|\bold x-\bold x^{\prime}\|^2/(2\sigma^2)\}$
For a nonlinear kernel $\kappa(\bold x,\bold x^{\prime})$, we obtain a valid kernel
$$ k(\bold x,\bold x^{\prime})=\exp\left\{-\frac{1}{2\sigma^2}(\kappa(\bold x,\bold x)+\kappa(\bold x^{\prime},\bold x^{\prime})-2\kappa(\bold x,\bold x^{\prime}))\right\} $$
Consider a fixed set and define a nonvectorial space consisting of all possible subsets of this set. If $A_1$ and $A_2$ are two such subsets then one simple choice of kernel would be
$$ k(A_1,A_2)=2^{|A_1\cap A_2|} $$
$|A|$ denotes the number of elements in $A$.
The construction of kernels starts from a probabilistic generative model.
Given a generative model $p(\bold x)$ we can give a kernel by
$$ k(\bold x,\bold x^{\prime})=p(\bold x)p(\bold x^{\prime}) $$
Consider sums over products of different probability distributions, with positive weighting coefficients $p(i)$, of the form
$$ k(\bold x,\bold x^{\prime})=\sum_{i}p(\bold x|i)p(\bold x^{\prime}|i)p(i) $$
Taking the limit of an infinite sum, we can consider kernels of the form
$$ k(\bold x,\bold x^{\prime})=\int p(\bold x|\bold z)p(\bold x^{\prime}|\bold z)p(\bold z)\ \text d\bold z $$
where $\bold z$ is a continuous latent variable.
Suppose that our data consists of ordered sequences of length $L$ so that an observation is given by $\bold X=\{\bold x_1,\cdots,x_L\}$. Consider the hidden Markov model, which is a generative model, with hidden states $\bold Z=\{\bold z_1,\cdots,\bold z_L\}$. A kernel function measuring the similarity of two sequences $\bold X$ and $\bold X^{\prime}$ which are generated by the same hidden sequence $\bold Z$ can be defined by
$$ k(\bold X,\bold X^{\prime})=\sum_{\bold Z}p(\bold X|\bold Z)p(\bold X^{\prime}|\bold Z)p(\bold Z) $$
Fisher kernel
Consider a parametric generative model $p(\bold x|\bm\theta)$ where $\bm\theta$ denotes the vector parameters. We consider the Fisher score
$$ \bold g(\bm\theta,\bold x)=\nabla_{\bm\theta}\log p(\bold x|\bm\theta) $$
from which the Fisher kernel is defined by
$$ k(\bold x,\bold x^{\prime})=\bold g(\bm\theta,\bold x)^{\text T}\bold F^{-1}\bold g(\bm\theta,\bold x^{\prime}) $$
Here $\bold F$ is the Fisher information matrix, given by
$$ \bold F=\Bbb E_{\bold x}\left[\bold g(\bm\theta,\bold x)\bold g(\bm\theta,\bold x)^{\text T}\right] $$
where the expectation is with respect to $\bold x$ under the distribution $p(\bold x|\bm\theta)$.
Note that the presence of the Fisher information matrix causes this kernel to be invariant under a nonlinear re-parameterization of the density model $\bm\theta\rightarrow\bm\psi(\bm\theta)$.
In practice, it is often infeasible to evaluate the Fisher information matrix. One approach is to replace the expectation in the definition of the Fisher information with the sample average, giving
$$ \bold F\simeq\frac{1}{N}\sum_{n=1}^N\bold g(\bm\theta,\bold x_n)\bold g(\bm \theta,\bold x_n)^{\text T} $$
We can just omit the Fisher information matrix altogether
$$ k(\bold x,\bold x^{\prime})=\bold g(\bm\theta,\bold x)^{\text T}\bold g(\bm\theta,\bold x^{\prime}) $$
The sigmoidal kernel given by
$$ k(\bold x,\bold x^{\prime})=\tanh(a\bold x^{\text T}\bold x^{\prime}+b) $$
whose Gram matrix in general is not positive semidefinite. It gives kernel expansions such as the support vector machine a superficial resemblance to neural network models.