本质上在做什么?
内积是距离度量,核函数相当于将低维空间的距离映射到高维空间的距离,并非对特征直接映射。
为什么要求核函数是对称且Gram矩阵是半正定?
核函数对应某一特征空间的内积,要求①核函数对称;②Gram矩阵半正定。
证明内积对应的Gram矩阵半正定:
α T K α = [ α 1 , α 2 , ⋯ , α n ] [ κ ( x 1 , x 1 ) κ ( x 1 , x 2 ) ⋯ κ ( x 1 , x n ) κ ( x 2 , x 1 ) κ ( x 2 , x 2 ) ⋯ κ ( x 1 , x n ) ⋮ ⋮ ⋱ ⋮ κ ( x n , x 1 ) κ ( x n , x 2 ) ⋯ κ ( x n , x n ) ] [ α 1 α 2 ⋮ α n ] = ∑ i = 1 n ∑ j = 1 n α i κ ( x i , x j ) α j = ∑ i = 1 n ∑ j = 1 n α i α j ⟨ ϕ ( x i ) , ϕ ( x j ) ⟩ = ⟨ ∑ i = 1 n α i ϕ ( x i ) , ∑ j = 1 n α j ϕ ( x j ) ⟩ = ∥ ∑ i = 1 n α i ϕ ( x i ) ∥ 2 2 ⩾ 0 \begin{aligned} {{ \bm \alpha}^{\rm T} {\bm K} { \bm \alpha}} &=\begin{bmatrix} {\alpha}_1, {\alpha}_2, \cdots, {\alpha}_n \end{bmatrix} \begin{bmatrix} \kappa \left( {\bm x}_1, {\bm x}_1 \right) &\kappa \left( {\bm x}_1, {\bm x}_2 \right) &\cdots &\kappa \left( {\bm x}_1, {\bm x}_n \right) \\ \kappa \left( {\bm x}_2, {\bm x}_1 \right) &\kappa \left( {\bm x}_2, {\bm x}_2 \right) &\cdots &\kappa \left( {\bm x}_1, {\bm x}_n \right) \\ \vdots &\vdots &\ddots &\vdots \\ \kappa \left( {\bm x}_n, {\bm x}_1 \right) &\kappa \left( {\bm x}_n, {\bm x}_2 \right) &\cdots &\kappa \left( {\bm x}_n, {\bm x}_n \right) \\ \end{bmatrix} \begin{bmatrix} {\alpha}_1 \\ {\alpha}2 \\ \vdots \\ {\alpha}n \\ \end{bmatrix} \\ &= \sum\limits{i=1}^{n} \sum\limits{j=1}^{n} {\alpha}_i \kappa \left( {\bm x}_i, {\bm x}j \right) {\alpha}j \\ &= \sum\limits{i=1}^{n} \sum\limits{j=1}^{n} {\alpha}_i {\alpha}_j \langle \phi \left( {\bm x}_i \right), \phi \left( {\bm x}j \right) \rangle\\ &= \langle \sum\limits{i=1}^{n} {\alpha}_i \phi \left( {\bm x}i \right), \sum\limits{j=1}^{n} {\alpha}_j \phi \left( {\bm x}j \right) \rangle \\ &= \lVert \sum\limits{i=1}^{n} {\alpha}_i \phi \left( {\bm x}_i \right) \rVert^2_2 \\ &\geqslant 0 \end{aligned} αTKα=[α1,α2,⋯,αn] κ(x1,x1)κ(x2,x1)⋮κ(xn,x1)κ(x1,x2)κ(x2,x2)⋮κ(xn,x2)⋯⋯⋱⋯κ(x1,xn)κ(x1,xn)⋮κ(xn,xn) α1α2⋮αn =i=1∑nj=1∑nαiκ(xi,xj)αj=i=1∑nj=1∑nαiαj⟨ϕ(xi),ϕ(xj)⟩=⟨i=1∑nαiϕ(xi),j=1∑nαjϕ(xj)⟩=∥i=1∑nαiϕ(xi)∥22⩾0