Understanding Machine Learning XII: Kernel Methods and the Representer TheoremTextbook
Motivation
Chapter 15 bounded the sample complexity of large-margin halfspaces by the norms of the data and of the separator, independently of the dimension. Chapter 16 of Shalev-Shwartz and Ben-David, Understanding Machine Learning: From Theory to Algorithms (doi:10.1017/CBO9781107298019) removes the remaining obstacle to using halfspaces in very high-dimensional feature spaces: computation. After embedding the data by a feature map into a Hilbert space, every SVM-like problem has the form (16.2), and the representer theorem (Theorem 16.1) says that an optimal solution lies in the span of the mapped examples. Consequently the problem can be rewritten in terms of the coefficients and the kernel alone (16.3): this is the kernel trick. The chapter exhibits the polynomial and Gaussian kernels (Examples 16.1 and 16.2), characterizes the functions that are kernels as the positive semidefinite ones (Lemma 16.2), and shows that the SGD solver for Soft-SVM of §15.5 can be run entirely on kernel evaluations (Lemma 16.3).
Setting
A feature map takes values in a real Hilbert space, a complete real inner product space; its kernel is , and a function implements an inner product in some Hilbert space if it is the kernel of some feature map into some Hilbert space, quantified existentially in the universe of the domain. The Gram matrix of a sample is . The general objective (16.2) is with arbitrary and nondecreasing on . The SGD procedure of §15.5 in the feature space keeps with (iterates indexed from ) and, at each step, for the chosen index , adds to when ; its kernelized version keeps coefficients with and tests . Both are driven by the same sequence of chosen indices, which stands for the uniformly random choices of the book.
Formalization targets
Goal: Theorem 16.1 (Representer Theorem)
If is nondecreasing on and the problem (16.2) has an optimal solution, then there is such that is an optimal solution.
Milestones
Equation (16.3). For the objective equals .
Example 16.1. The polynomial kernel on is for the monomial map into .
Example 16.2. On , the map into has ; the Gaussian kernel on is a kernel for every .
Lemma 16.2. A symmetric is a kernel iff all its Gram matrices are positive semidefinite.
Lemma 16.3. The kernelized SGD reproduces the feature-space SGD: for all , hence the outputs coincide.
Further items: Exercise 16.3 (kernel ridge regression: minimizers of the coefficient objective give minimizers of the ridge objective, and gives one), Exercise 16.4 ( is a kernel), Exercise 16.6 (the nearest-class-mean rule is a halfspace).
Significance
The representer theorem is the reason kernel methods exist: it reduces an optimization over an arbitrary Hilbert space to one over , and Lemma 16.2 says the reduction needs nothing but a positive semidefinite similarity function, so one may design the kernel directly, as in the string example of §16.2.1. Lemma 16.3 makes the connection to Chapter 14 concrete: a first-order method never leaves the span of the examples, so it too can be run on the Gram matrix. Together with Chapter 15, the chapter closes the book's treatment of linear predictors: expressive through the embedding, statistically controlled through the margin, and computable through the kernel.
Nothing here is machine-checked. The statements are faithful to the book with two clarifications: the representer theorem assumes the existence of an optimal solution, which the book's proof also assumes, and the kernel-SGD equivalence is stated for a fixed sequence of chosen indices, which is the content of the book's inductive proof.
Difficulty
Equation (16.3) and Exercise 16.6 are inner-product algebra and the entry points. The representer theorem needs the orthogonal decomposition with orthogonal to the span, which is available in Mathlib for the finite-dimensional, hence complete, subspace spanned by the , together with the Pythagorean identity and the monotonicity of . Example 16.1 is the multinomial expansion of as a sum over index vectors, packaged as an inner product in the Euclidean space indexed by . Example 16.2 needs the summability of and the exponential series, and, for the general Gaussian kernel, either an explicit construction or Lemma 16.2 together with the positive semidefiniteness of the Gaussian Gram matrix. Lemma 16.2 in the nontrivial direction is the construction of the reproducing kernel Hilbert space: the pre-Hilbert space of finite combinations of the functions , the inner product defined through , its well-definedness and positive definiteness from the Gram matrices, and the completion, which Mathlib provides for inner product spaces. Lemma 16.3 is an induction on with the identity . Exercise 16.3 combines the representer theorem with the identity between the two objectives on the span and the first-order condition for a convex quadratic; Exercise 16.4 needs a feature map such as , or the positive semidefiniteness of the min matrix.
Formalization scope
Hilbert spaces are real, complete inner product spaces; the existential in IsKernel ranges over Hilbert spaces in the universe of the domain, which the reproducing kernel construction respects. The objective (16.2) has real-valued , so the hard-SVM instance with is not covered by the representer item as stated. The SGD procedures are deterministic given the index sequence; the random choice of indices is not modelled, exactly as in Lemma 16.3's proof. The string kernel of §16.2.1 and Exercise 16.1, the kernelized Perceptron (Exercise 16.2), Exercise 16.5 and part (2) of Exercise 16.6 are not stated.
Trivializing readings are excluded: the representer theorem asserts optimality against every , Lemma 16.2 is a biconditional with symmetry assumed as the book does, and the kernels of the examples are exhibited with explicit feature spaces where the book gives them. Welcome contributions: the orthogonal decomposition against a finite span, the multinomial identity of Example 16.1, and the reproducing kernel Hilbert space construction behind Lemma 16.2.
Selected references
- S. Shalev-Shwartz, S. Ben-David, Understanding Machine Learning: From Theory to Algorithms, Cambridge University Press, 2014, Chapter 16. doi:10.1017/CBO9781107298019
- B. Schölkopf, R. Herbrich, A. J. Smola, A generalized representer theorem, Proceedings of COLT, 2001. doi:10.1007/3-540-44581-1_27
- N. Aronszajn, Theory of reproducing kernels, Transactions of the American Mathematical Society 68(3), 1950. doi:10.1090/S0002-9947-1950-0051437-7
- B. Schölkopf, A. J. Smola, Learning with Kernels, MIT Press, 2002.
- M. A. Aizerman, E. M. Braverman, L. I. Rozonoer, Theoretical foundations of the potential function method in pattern recognition learning, Automation and Remote Control 25, 1964.