Solution (source code)

= Solution

The feature space may be extremely high-dimensional or infinite-dimensional, and $\phi$ may be known only implicitly. Instead, compute the leading eigenvector $\alpha$ of the <kernel matrix> $K$, normalize it by $\alpha^\top K\alpha=1$, and use the <kernel trick>:
$$
s(x)=\langle v,\phi(x)\rangle
=\sum_{i=1}^n\alpha_i k(x_i,x).
$$
This requires only kernel evaluations.