Kernels

我们首先来回顾kernel函数的定义:一个函数$K(x,y)$为kernel函数当且仅当对$\forall g, \int K(x,y)g(x)g(y)dxdy\geq 0$成立。另外,根据Mercer's theorem,存在一个映射$\Phi$使$K(x,y)=\langle \Phi(x),\Phi(y)\rangle$,并且对任意有限的点,kernel矩阵是半正定的。

一、核函数的封闭性

Hadamard product:

$$\mathbf{A}\circ\mathbf{B}=\left[\begin{array}&a_{11}b_{11}&a_{12}b_{12}&\cdots&a_{1n}b_{1n}\\\vdots\\a_{m1}b_{m1}&a_{m2}b_{m2}&\cdots&a_{mn}b_{mn}\end{array}\right]$$ Kronecked product:

$$\mathbf{A}\otimes\mathbf{B}=\left[\begin{array}&a_{11}\mathbf{B}&a_{12}\mathbf{B}&\cdots&a_{1n}\mathbf{B}\\\vdots\\a_{m1}\mathbf{B}&a_{m2}\mathbf{B}&\cdots&a_{mn}\mathbf{B}\end{array}\right]$$

若$K_1(x,y),K_2(x,y)$为kernel函数,则以下式子仍为kernel函数。

  1. $K_1(x,y)+K_2(x,y)$
  2. $aK_1(x,y),\quad (a>0)$
  3. $K_1(x,y)K_2(x,y)$
  4. $f(x)f(y)\quad \forall f$
  5. $x^\prime\mathbf{A}y,\quad \text{for positive semidefinite }\mathbf{A}$
  6. $f(x)K_1(x,y)f(y), \forall f$
  7. $q(K_1(x,y))$, 其中$q$是非负系数的多项式
  8. $exp\{K_1(x,y)\}$

二、例子

令$K(x,y)=(\langle x,y\rangle+C)^d=\sum_{s=0}^d\binom{d}{s}C^s\langle x,y\rangle^{d-s},(C\geq 0)$

这个函数可以看成单项为$\langle x,y\rangle^{d-s}$的一个多项式,系数为$\binom{d}{s}C^s$,所以它是个核函数。当$C=0$时,$(\langle x,y\rangle)^r=(x_1y_1+x_2y_2+\cdots+x_my_m)^r$。

可以把上式看成一个单项为$x_1^{i_1}y_1^{i_1}x_2^{i_2}y_2^{i_2}\cdots x_m^{i_m}y_m^{i_m}$所组成的多项式,其中$i_1+i_2+\cdots+i_m=r,i_1,i_2,\cdots,i_m\geq 0$。

令$\Phi(x)\triangleq\left[\begin{array}&\vdots\\x_1^{i_1}x_2^{i_2}\cdots x_m^{i_m}\\\vdots\end{array}\right]$,则$(\langle x,y\rangle)^r=\langle\Phi(x),\Phi(y)\rangle=K(x,y)$,可以证明上式的映射$\Phi(x)$为$\binom{M+r-1}{r}$维。

证明:(重复排列的证明)

命题等价于从$1,2,\cdots,m$中选出$r$个数的重复排列。设选出的数为$a_1,a_2,\cdots,a_r$,其中令$a_1\leq a_2\leq\cdots\leq a_r$。命题等价于求满足上述不等式$a_1,a_2,\cdots,a_r$的组合个数。构造$b_1=a_1,b_2=a_2+1,\cdots,b_i=a_i+(i-1),\cdots,b_r=a_r+(r-1)$,其中$b_1<b_2<\cdots<b_r$且$b_i$与$a_i$对应,所以命题又等价于求$b_i$的组合数,而$b_i$取值于$1\sim (n+m-1)$,故$b_i$的组合数为$\binom{n+m-1}{m}$。

从上述可以看出映射后的空间维数是非常大的,而引入核函数使我们只需要利用核函数进行计算,从而可以省去中间的映射过程。

高斯核函数:$K(x,y)=exp\{-\frac{1}{2}\|x-y\|^2\}$,as the pointwise limit of polynomials。高斯核函数对应的映射为无限维。

Pointwise convergence:假定$\{f_n\}$是一个有相同定义域和上域的函数序列,$\{f_n\}$逐点收敛于$f$,记$\lim_{n\to\infty}f_n=f$,当且仅当$\lim_{n\to\infty}f_n(x)=f(x)$对$\forall x$属于定义域都成立。

三、不同核函数所对应的映射

对于每一个核函数$K_i$,必定对应着至少一个映射$\Phi_i$。假设$K_1(x,y),K_2(x,y)$对应的映射为$\Phi_1,\Phi_2$,则:

  1. $K(x,y)=K_1(x,y)+K_2(x,y)$对应的映射为$\Phi(x)=(\Phi_1(x),\Phi_2(x))^\prime$。
  2. $K(x,y)=aK_1(x,y),a>0$对应的映射为$\Phi(x)=\sqrt{a}\Phi_1(x)$。
  3. $K(x,y)=K_1(x,y)K_2(x,y)$对应的映射为$\Phi(x)_{ij}=\Phi_1(x)_i\Phi_2(x)_j$,即$\Phi(x)=\left[\begin{array}&\Phi_1(x)_1\Phi_2(x)_1\\\vdots\\\Phi_1(x)_1\Phi_2(x)_n\\\vdots\\\Phi_1(x)_n\Phi_2(x)_1\\\vdots\\\Phi_1(x)_n\Phi_2(x)_n\end{array}\right]$。
  4. $K(x,y)=f(x)f(y),\forall f$对应的映射的$\Phi(x)=f(x)$。
  5. $K(x,y)=x^\prime\mathbf{A}y$,其中$\mathbf{A}$为半正定,对应的映射为$\Phi(x)=\mathbf{L}^\prime x$,其中$\mathbf{A}=\mathbf{L}\mathbf{L}^\prime$(Cholesky分解)

四、在映射后的空间中操作

1)$\|\Phi(x)\|=\sqrt{\langle\Phi(x),\Phi(x)\rangle}=\sqrt{K(x,x)}$。

2) 单位化:$\tilde{\Phi}(x)=\frac{\Phi(x)}{\|\Phi(x)\|}$

$$\tilde{K}(x,y)=\langle \tilde{\Phi}(x),\tilde{\Phi}(y)\rangle=\frac{\langle \Phi(x),\Phi(y)\rangle}{\|\Phi(x)\|\|\Phi(y)\|}=\frac{K(x,y)}{\sqrt{k(x,x)K(y,y)}}$$,为正则化的kernel(Normalized kernel)。

3)线性组合的范数

\begin{align*}\|\sum_{i}\alpha_i\Phi(x_i)\|^2&=\langle \sum_i\alpha_i\Phi(x_i),\sum_j\alpha_j\Phi(x_j)\rangle\\&=\sum_{i,j}\alpha_i\alpha_j\langle\Phi(x_i),\Phi(x_j)\rangle\\&=\sum_{i,j}\alpha_i\alpha_jK(x_i,x_j)\\&=\alpha^\prime K\alpha\end{align*}

五、最后

关于kernel的内容有非常多的东西,这里我只是简单的介绍(其实我对kernel也就懂这么点皮毛)。有兴趣的可以看看这本专门介绍kernel的书籍<Kernel Methods for Pattern Analysis>,还有论文<An Introduction to Kernel-Based Learning Algorithms>。

Jordan Lecture Note-5: Kernels的更多相关文章

  1. Jordan Lecture Note-1: Introduction

    Jordan Lecture Note-1: Introduction 第一部分要整理的是Jordan的讲义,这份讲义是我刚进实验室时我们老师给我的第一个任务,要求我把讲义上的知识扩充出去,然后每周都 ...

  2. Jordan Lecture Note-3: 梯度投影法

    Jordan Lecture Note-3:梯度投影法 在这一节,我们介绍如何用梯度投影法来解如下的优化问题: \begin{align} \mathop{\min}&\quad f(x)\n ...

  3. Colorful Lecture Note(手工栈)

    题目1 : Colorful Lecture Note 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Little Hi is writing an algorithm ...

  4. HihoCoder - 1103 Colorful Lecture Note

    Little Hi is writing an algorithm lecture note for Little Ho. To make the note more comprehensible, ...

  5. Colorful Lecture Note

    Colorful Lecture Note 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Little Hi is writing an algorithm lectu ...

  6. hihocoder #1103 : Colorful Lecture Note微软苏州校招笔试 1月10日(字符串处理+栈)

    #1103 : Colorful Lecture Note 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Little Hi is writing an algorit ...

  7. Jordan Lecture Note-2: Maximal Margin Classifier

    Maximal Margin Classifier Logistic Regression 与 SVM 思路的不同点:logistic regression强调所有点尽可能远离中间的那条分割线,而SV ...

  8. Jordan Lecture Note-12: Kernel典型相关分析(Kernel Canonical Correlation Analysis, KCCA).

    Kernel典型相关分析 (一)KCCA 同样,我们可以引入Kernel函数,通过非线性的坐标变换达到之前CCA所寻求的目标.首先,假设映射$\Phi_X: x\rightarrow \Phi_X(x ...

  9. Jordan Lecture Note-11: 典型相关分析(Canonical Correlation Analysis, CCA).

    典型相关分析 (一)引入 典型相关分析(Canonical Correlation Analysis)是研究两组变量之间相关关系的一种多元统计方法.他能够揭示出两组变量之间的内在联系. 我们知道,在一 ...

随机推荐

  1. RPi 2B GPIO 测试

    /************************************************************************************** * RPi 2B GPI ...

  2. CSS遮罩——如何在CSS中使用遮罩

    Css遮罩是2008年4月由苹果公司添加到webkit引擎中的.遮罩提供一种基于像素级别的,可以控制元素透明度的能力,类似于png24位或png32位中的alpha透明通道的效果. 图像是由rgb三个 ...

  3. Cookie帮助类

    using System; using System.Collections.Generic; using System.Text; using System.Web; namespace AIMSC ...

  4. HDU5692 Snacks DFS+线段树

    分析:一棵以1为根的有根树,然后每个点维护从根到当前节点的路径和,当修改一个点时 只会影响的子树的和,最优值也是子树最大的值 #include <cstdio> #include < ...

  5. Zabbix探索:工作时间的设置

    默认情况下,Zabbix的工作时间是启用的. 启用后,图形的北京在工作时间内就是白底的,否则就是灰底的. 今天纠结了半天,因为无论如何都是灰底的. 后来连接到服务器上一看,靠,忘记同步时间了,所以刚好 ...

  6. leetcode—Same Tree

    1.题目描述 Given two binary trees, write a function to check if they are equal or not.   Two binary tree ...

  7. TCP/IP协议栈及OSI参考模型详解

    OSI参考模型 OSI RM:开放系统互连参考模型(open systeminterconnection reference model) OSI参考模型具有以下优点: 简化了相关的网络操作: 提供设 ...

  8. Fragment回调顺序及getActivity()为NullPointerException解决方法

    Fragment回调顺序 onAttach->onCreate->onCreateView->onActivityCreated ps:最后发现经常在Fragment里面getAct ...

  9. 【C语言】- 数据输出-printf( )和putchar( )

    格式化输出函数printf( ) printf( )功能: 向系统指定输出设备按指定的格式输入任意个任意类型的数据,并返回实际输出的字符数.若出错,将返回负数. printf( )使用形式: prin ...

  10. STL学习系列二:Vector容器

    1.Vector容器简介 vector是将元素置于一个动态数组中加以管理的容器. vector可以随机存取元素(支持索引值直接存取, 用[]操作符或at()方法,这个等下会详讲). vector尾部添 ...