Reproducing Kernel Hilbert Spaces-Greg Durrett
Reproducing Kernel Hilbert Spaces-Greg Durrett
1 Introduction
In the previous two lectures, we’ve discussed the connections of the learning problem to statistical
inference. However, unlike in traditional statistics, our primary goal with learning is to predict the
future rather than describe the data at hand. We also typically have a much smaller sample of data
in a much higher-dimensional space, so we cannot blindly choose a model and assume it will be
accurate. If the model is too highly-parameterized, it will react too strongly to the data, we will
overfit the data, and we will fail to learn the underlying phenomenon (see Figure 1 for an example of
this behavior). However, models with too few parameters may not even describe the training data
adequately, and will provide similarly bad performance.
Regularization provides us with one way to strike the appropriate balance in creating our model.
It requires a (possibly large) class of models and a method for evaluating the complexity of each
model in the class. The concept of “kernels” will provide us with a flexible, computationally feasible
method for implementing this scheme.
(a) Data set for which we wish to (b) Smooth function that will likely (c) Function that probably does not
learn a function be a good predictor of future points model the data well, but still mini-
mizes empirical error
The goal of these notes will be to introduce a particularly useful family of hypothesis spaces called
reproducing kernel Hilbert spaces (RKHS), each of which is associated with a particular kernel, and
to derive the general solution of Tikhonov regularization in RKHS, known as the representer theorem.
2 Regularization
The goal of regularization is to restore the well-posedness (specifically, making the result depend
smoothly on the data) of the empirical risk minimization (ERM) technique by effectively restricting
the hypothesis space H. One way of doing this is introduce a penalization term in our minimization
as follows:
ERR(f ) +λ pen(f )
| {z } | {z }
empirical error penalization term
3-1
where the regularization parameter λ controls the tradeoff between the two terms. This will then
cause the minimization to seek out simpler functions, which incur less of a penalty.
Tikhonov regularization can be written in this way, as
n
1X
V (f (xi ), yi ) + λkf k2H , (1)
n i=1
where
2. kf + gk ≤ kf k + kgk;
3. kαf k = |α| kf k.
p
A norm can be defined via an inner product, as kf k = hf, f i
Note that while the dot product in Rd is an example of an inner product, an inner product is more
general than this, and requires only those properties given above. Similarly, while the Euclidean
norm is an example of a norm, we consider a wider class of norms on the function spaces we will
use.
3-2
Definition 4 A Hilbert space is a complete, (possibly) infinite-dimensional linear space endowed
with an inner product.
p
A norm in H can be naturally defined from the given inner product, as k · k = h·, ·i. Although
it is possible to impose a different norm so long as it satisfies the criteria given above, we will not do
this in general; our norm is assumed to be the norm derived from the inner product. Furthermore,
we always assume that H is separable (contains a countable dense subset) so that H has a countable
orthonormal basis.
While this tells us what a Hilbert space is, it is not intuitively clear why we need this mechanism,
or what we gain by using it. Essentially, a Hilbert space lets us apply concepts from finite-dimensional
linear algebra to infinite-dimensional spaces of functions. In particular, the fact that a Hilbert space
is complete will guarantee the convergence of certain algorithms. More importantly, the presence
of an inner product allows us to make use of orthogonality and projections, which will later become
important.
However, there is no inner product for the space that induces this norm, so it is not a Hilbert
space.
• Another example is square integrable functions on the interval [a, b], denoted by L2 [a, b]. We
define the inner product as
Z b
hf, gi = f (x)g(x)dx
a
This produces the correct norm:
Z b
kf k = f 2 (x)dx
a
It can be checked that this space is complete, so it is a Hilbert space. However, there is one
problem with the functions in this space. Consider trying to evaluate the function f (x) at the
point x = k. There exists a function g in the space defined as follows:
(
c if x = k
g(x) =
f (x) otherwise
Because it differs from f only at one point, g is clearly still square-integrable, and moreover,
kf − gk = 0. However, we can set the constant c (or, more generally, the value of g(x) at any
finite number of points) to an arbitrary real value. What this means is that a condition on the
integrability of the function is not strong enough to guarantee that we can use it predictively,
since prediction requires evaluating the function at a particular data value. This characteristic
is what will differentiate reproducing kernel Hilbert spaces from ordinary Hilbert spaces, as
we discuss in the next section.
3-3
Definition 6 A Hilbert space H is a reproducing kernel Hilbert space (RKHS) if the evalu-
ation functionals are bounded, i.e. if for all t there exists some M > 0 such that
This condition is not trivial. For L2 [a, b], we showed above that there exist functions that are square-
integrable, but which have arbitrarily large values on finite point sets. In this case, no choice of M
will give us the appropriate bound on these functions on these point sets.
While this condition might seem obscure or specific, it is actually quite general and is the weakest
possible condition that ensures us both the existence of an inner product and the ability to evaluate
each function in the space at every point in the domain. In practice, it is difficult to work with this
definition directly. We would like to establish an equivalent notion that is more useful in practice.
To do this, we will need the “reproducing kernel” from which the reproducing kernel Hilbert space
takes its name.
First, from the definition of the reproducing kernel Hilbert space, we can use the Riesz represen-
tation theorem to prove the following property.
Theorem 7 If H is a RKHS, then for each t ∈ X there exists a function Kt ∈ H (called the
representer of t) with the reproducing property
This allows us to represent our linear evaluation functional by taking the inner product with an
element of H. Since Kt is a function in H, by the reproducing property, for each x ∈ X we can write
Kt (x) = hKt , Kx iH .
K(t, x) := Kt (x)
Proof: To prove the first statement, we must prove that the reproducing kernel K(t, x) =
hKt , Kx iH is symmetric and positive-definite.
Symmetry follows from the symmetry property of inner products:
hKt , Kx iH = hKx , Kt iH .
3-4
K is positive-definite because
n
X n
X n
X 2
ci cj K(ti , tj ) = ci cj hKti , Ktj iH = cj Ktj ≥ 0.
H
i,j=1 i,j=1 j=1
To prove the second statement, given K one can construct the RKHS H as the completion of the
space of functions spanned by the set {Kx |x ∈ X} with an inner product defined as follows: given
two functions f and g in span{Kx |x ∈ X}
s
X
f (x) = αi Kxi (x)
i=1
0
s
X
g(x) = βi Kx0i (x)
i=1
3-5
Sobolev kernel Consider functions f : [0, 1] → R with f (0) = f (1) = 0. The kernel
K(x, y) = Θ(y − x)(1 − y)x + Θ(x − y)(1 − x)y
induces the norm Z Z
kf k2H = (f 0 (x))2 dx = ω 2 |F (ω)|2 dω
R∞
where F (ω) = F{f }(ω) = −∞ f (t)e−iωt dt is the Fourier tranform of f . Such a norm is very
useful because it allows us to regularize on the basis of frequency content. In particular, the more
prominent the high-frequency components of f , the higher kf k2H will be; in fact, the norm will be
infinite for any function whose frequency magnitudes do not decay faster than ω1 . This imposes a
condition on the smoothness of the functions, since a high derivative gives rise to high frequency
components.
The (somewhat mysterious) reproducing kernel written above was designed to yield this useful
norm, and was not created arbitrarily.
Gaussian kernel It is possible to see that the Gaussian kernel yields as the norm:
Z
1 σ2 ω2
kf k2H = d
|F (ω)|2 e 2 dω
2π
which penalizes high-frequency components even more harshly.
3-6
! ! !
'()*
'(&)
% % %
!! !! !!
!! !"#$ !" !%#$ % %#$ " "#$ ! !! !"#$ !" !%#$ % %#$ " "#$ ! !! !"#$ !" !%#$ % %#$ " "#$ !
& & &
Figure 2: Three different training sets to demonstrate that higher slopes are necessary to describe
the data as the class distinctions become finer.
where the regularization parameter λ is a positive real number, H is the RKHS as defined by the
reproducing kernel K(·, ·), and V (·, ·) is the loss function.
We have imposed stability on this problem through the use of regularization, but we still need to
check the other two criteria of well-posedness. Does there always exist a solution to the minimization,
and is that solution unique? As it turns out, this requires a condition on the loss function. If the
positive loss function V (·, ·) is convex with respect to its first entry, the functional
n
1X
Φ[f ] = V (f (xi ), yi ) + λkf k2H
n i=1
is strictly convex and coercive (meaning that it grows quickly at the extremes of the space),
hence it has exactly one local (and therefore global) minimum.
Both the squared loss and the hinge loss are convex (see Figure 3). On the contrary the 0-1 loss
V = Θ(−f (x)y),
8
3.5
7
3
6
2.5
5
Hinge Loss
L2 loss
2
4
1.5
3
1
2
0.5
1
0
0
−3 −2 −1 0 1 2 3 −3 −2 −1 0 1 2 3
y−f(x) y * f(x)
3-7
amount of storage? Our solution to Tikhonov regularization could in principle be impossible to write
down for this reason, but it is a surprising result that it actually has a very compact representation,
as described in the following theorem.
Theorem 11 (The Representer Theorem) The minimizer over the RKHS H, fSλ , of the regu-
larized empirical functional
IS [f ] + λkf k2H ,
can be represented by the expression
n
X
fSλ (x) = ci K(xi , x),
i=1
for some n-tuple (c1 , . . . , cn ) ∈ Rn . Hence, minimizing over the (possibly infinite-dimensional)
Hilbert space boils down to minimizing over Rn .
There are only a finite number n of training set points, so the fact that the minimizer can be
written as a linear combination of kernel terms from these points guarantees that we can represent
the minimizer as a vector in Rn .
We provide a sketch of the proof for this theorem.
Proof: Define the linear subspace of H,
n
X
H0 = {f ∈ H | f = αi Kxi }.
i=1
This is the space spanned by the representers of the training set. Let H0⊥ be the linear subspace of
H orthogonal to H0 , i.e.
H0 is finite-dimensional, hence closed, so we can write H = H0 ⊕ H0⊥ . Now we see that every
f ∈ H can be uniquely decomposed into a component along H0 , denoted by f0 , and a component
perpendicular to H0 , given by f0⊥ :
f = f0 + f0⊥ .
By orthogonality
kf0 + f0⊥ k2 = kf0 k2 + kf0⊥ k2
and by the reproducing property
IS [f0 + f0⊥ ] = IS [f0 ],
since evaluating f (xi ) = f0 (xi ) + f0⊥ (xi ) to compute the empirical error requires taking the inner
product with the representer Kxi , and doing so nullifies the f0⊥ term while preserving the f0 term
intact.
Combining these two facts, we see that
IS [f0 + f0⊥ ] + λkf0 + f0⊥ k2H = IS [f0 ] + λkf0 k2H + λkf0⊥ k2H ≥ IS [f0 ] + λkf0 k2H
3-8