PRML学习总结(6)——Kernel Methods

  • 6.1 Dual Representations
  • 6.2 Constructing Kernels
  • 6.3 Radial Basis Function Networks
    • 6.3.1 Nadaraya-Watson model
  • 6.4 Gaussian Processes
    • 6.4.1 Linear regression revisited
    • 6.4.2 Gaussian processes for regression
    • 6.4.3 Learning the hyperparameters
    • 6.4.4 Automatic relevance determination
    • 6.4.5 Gaussian processes for classification
    • 6.4.6 Laplace approximation
    • 6.4.7 Connection to neural networks

在第3章和第4章,我们考虑了回归问题和分类问题的线性参数模型,其中从输⼊ x \mathbf x x到输出y的映射 y ( x , w ) y ( \mathbf { x } , \mathbf { w } ) y(x,w)的形式由可调节参数构成的向量 w \mathbf w w控制。在学习阶段,⼀组训练数据⽤来得到参数向量的点估计,或者⽤来确定这个向量的后验概率分布。然后,训练数据之后被丢弃,对于新输⼊的预测纯粹依靠学习到的参数向量 w \mathbf w w。这个⽅法也被⽤于⾮线性参数模型,例如神经⽹络。
然⽽,有这样⼀类模式识别的技术:训练数据点或者它的⼀个⼦集在预测阶段仍然保留并且被使⽤。

6.1 Dual Representations

许多回归的线性模型和分类的线性模型的公式都可以使⽤对偶表⽰重写。使⽤对偶表⽰形式,核函数可以⾃然地产⽣。在我们下⼀章中讨论⽀持向量机的时候,这个概念⼗分重要。这⾥,我们考虑⼀个线性模型,它的参数通过最⼩化正则化的平⽅和误差函数来确定。正则化的平⽅和误差函数为 J ( w ) = 1 2 ∑ n = 1 N { w T ϕ ( x n ) − t n } 2 + λ 2 w T w J ( \mathbf { w } ) = \frac { 1 } { 2 } \sum _ { n = 1 } ^ { N } \left\{ \mathbf { w } ^ { \mathrm { T } } \mathbf { \phi } \left( \mathbf { x } _ { n } \right) - t _ { n } \right\} ^ { 2 } + \frac { \lambda } { 2 } \mathbf { w } ^ { \mathrm { T } } \mathbf { w } J(w)=21​n=1∑N​{wTϕ(xn​)−tn​}2+2λ​wTw其中 λ ≥ 0 \lambda \ge0 λ≥0。当对以上目标函数对 w \mathbf w w求导为0,可得 w = − 1 λ ∑ n = 1 N { w T ϕ ( x n ) − t n } ϕ ( x n ) = ∑ n = 1 N a n ϕ ( x n ) = Φ T a \mathbf { w } = - \frac { 1 } { \lambda } \sum _ { n = 1 } ^ { N } \left\{ \mathbf { w } ^ { \mathrm { T } } \boldsymbol { \phi } \left( \mathbf { x } _ { n } \right) - t _ { n } \right\} \phi \left( \mathbf { x } _ { n } \right) = \sum _ { n = 1 } ^ { N } a _ { n } \phi \left( \mathbf { x } _ { n } \right) = \mathbf { \Phi } ^ { \mathrm { T } } \mathbf { a } w=−λ1​n=1∑N​{wTϕ(xn​)−tn​}ϕ(xn​)=n=1∑N​an​ϕ(xn​)=ΦTa其中 Φ \mathbf { \Phi } Φ的第 n n n行为 ϕ ( x n ) T \phi \left( \mathbf { x } _ { n } \right) ^ { T } ϕ(xn​)T, a = ( a 1 , … , a N ) T \mathbf { a } = \left( a _ { 1 } , \dots , a _ { N } \right) ^ { \mathrm { T } } a=(a1​,…,aN​)T且 a n = − 1 λ { w T ϕ ( x n ) − t n } a _ { n } = - \frac { 1 } { \lambda } \left\{ \mathbf { w } ^ { \mathrm { T } } \boldsymbol { \phi } \left( \mathbf { x } _ { n } \right) - t _ { n } \right\} an​=−λ1​{wTϕ(xn​)−tn​}将上式带入原目标函数 J ( a ) = 1 2 a T Φ Φ T Φ Φ T a − a T Φ Φ T t + 1 2 t T t + λ 2 a T Φ Φ T a J ( \mathbf { a } ) = \frac { 1 } { 2 } \mathbf { a } ^ { \mathrm { T } } \mathbf { \Phi } \mathbf { \Phi } ^ { \mathrm { T } } \mathbf { \Phi } \mathbf { \Phi } ^ { \mathrm { T } } \mathbf { a } - \mathbf { a } ^ { \mathrm { T } } \mathbf { \Phi } \mathbf { \Phi } ^ { \mathrm { T } } \mathbf { t } + \frac { 1 } { 2 } \mathbf { t } ^ { \mathrm { T } } \mathbf { t } + \frac { \lambda } { 2 } \mathbf { a } ^ { \mathrm { T } } \mathbf { \Phi } \mathbf { \Phi } ^ { \mathrm { T } } \mathbf { a } J(a)=21​aTΦΦTΦΦTa−aTΦΦTt+21​tTt+2λ​aTΦΦTa其中 t = ( t 1 , … , t N ) T \mathbf { t } = \left( t _ { 1 } , \dots , t _ { N } \right) ^ { \mathrm { T } } t=(t1​,…,tN​)T,定义Gram matrix K = Φ Φ T \mathbf { K } = \mathbf { \Phi } \mathbf { \Phi } ^ { \mathrm { T } } K=ΦΦT其中 K n m = ϕ ( x n ) T ϕ ( x m ) = k ( x n , x m ) K _ { n m } = \phi \left( \mathbf { x } _ { n } \right) ^ { \mathrm { T } } \boldsymbol { \phi } \left( \mathbf { x } _ { m } \right) = k \left( \mathbf { x } _ { n } , \mathbf { x } _ { m } \right) Knm​=ϕ(xn​)Tϕ(xm​)=k(xn​,xm​)此处引入kernel function k ( x , x ′ ) k \left( \mathbf { x } , \mathbf { x } ^ { \prime } \right) k(x,x′)将Gram matrix代入 J ( a ) = 1 2 a T K K a − a T K t + 1 2 t T t + λ 2 a T K a J ( \mathbf { a } ) = \frac { 1 } { 2 } \mathbf { a } ^ { \mathrm { T } } \mathbf { K } \mathbf { K } \mathbf { a } - \mathbf { a } ^ { \mathrm { T } } \mathbf { K } \mathbf { t } + \frac { 1 } { 2 } \mathbf { t } ^ { \mathrm { T } } \mathbf { t } + \frac { \lambda } { 2 } \mathbf { a } ^ { \mathrm { T } } \mathbf { K } \mathbf { a } J(a)=21​aTKKa−aTKt+21​tTt+2λ​aTKa则上式对 a \mathbf a a求导为0 a = ( K + λ I N ) − 1 t \mathbf { a } = \left( \mathbf { K } + \lambda \mathbf { I } _ { N } \right) ^ { - 1 } \mathbf { t } a=(K+λIN​)−1t将上式再带入回归模型中 y ( x ) = w T ϕ ( x ) = a T Φ ϕ ( x ) = k ( x ) T ( K + λ I N ) − 1 t y ( \mathbf { x } ) = \mathbf { w } ^ { \mathrm { T } } \boldsymbol { \phi } ( \mathbf { x } ) = \mathbf { a } ^ { \mathrm { T } } \boldsymbol { \Phi } \phi ( \mathbf { x } ) = \mathbf { k } ( \mathbf { x } ) ^ { \mathrm { T } } \left( \mathbf { K } + \lambda \mathbf { I } _ { N } \right) ^ { - 1 } \mathbf { t } y(x)=wTϕ(x)=aTΦϕ(x)=k(x)T(K+λIN​)−1t其中 k ( x ) \mathbf { k } ( \mathbf { x } ) k(x) with elements k n ( x ) = k ( x n , x ) k _ { n } ( \mathbf { x } ) = k \left( \mathbf { x } _ { n } , \mathbf { x } \right) kn​(x)=k(xn​,x)

6.2 Constructing Kernels

第一种构造方式是根据定义, k ( x , x ′ ) = ϕ ( x ) T ϕ ( x ′ ) = ∑ i = 1 M ϕ i ( x ) ϕ i ( x ′ ) k \left( x , x ^ { \prime } \right) = \phi ( x ) ^ { \mathrm { T } } \phi \left( x ^ { \prime } \right) = \sum _ { i = 1 } ^ { M } \phi _ { i } ( x ) \phi _ { i } \left( x ^ { \prime } \right) k(x,x′)=ϕ(x)Tϕ(x′)=i=1∑M​ϕi​(x)ϕi​(x′)

另⼀种⽅法是直接构造核函数。在这种情况下,我们必须确保我们核函数是合法的,即它对应于某个(可能是⽆穷维)特征空间的标量积。作为⼀个简单的例⼦,考虑下⾯的核函数 k ( x , z ) = ( x T z ) 2 k ( \mathbf { x } , \mathbf { z } ) = \left( \mathbf { x } ^ { \mathrm { T } } \mathbf { z } \right) ^ { 2 } k(x,z)=(xTz)2可以发现通过以下变换可以变成定义 k ( x , z ) = ( x T z ) 2 = ( x 1 z 1 + x 2 z 2 ) 2 = x 1 2 z 1 2 + 2 x 1 z 1 x 2 z 2 + x 2 2 z 2 2 = ( x 1 2 , 2 x 1 x 2 , x 2 2 ) ( z 1 2 , 2 z 1 z 2 , z 2 2 ) T = ϕ ( x ) T ϕ ( z ) \begin{aligned} k ( \mathbf { x } , \mathbf { z } ) & = \left( \mathbf { x } ^ { \mathrm { T } } \mathbf { z } \right) ^ { 2 } = \left( x _ { 1 } z _ { 1 } + x _ { 2 } z _ { 2 } \right) ^ { 2 } \\ & = x _ { 1 } ^ { 2 } z _ { 1 } ^ { 2 } + 2 x _ { 1 } z _ { 1 } x _ { 2 } z _ { 2 } + x _ { 2 } ^ { 2 } z _ { 2 } ^ { 2 } \\ & = \left( x _ { 1 } ^ { 2 } , \sqrt { 2 } x _ { 1 } x _ { 2 } , x _ { 2 } ^ { 2 } \right) \left( z _ { 1 } ^ { 2 } , \sqrt { 2 } z _ { 1 } z _ { 2 } , z _ { 2 } ^ { 2 } \right) ^ { \mathrm { T } } \\ & = \boldsymbol { \phi } ( \mathbf { x } ) ^ { \mathrm { T } } \boldsymbol { \phi } ( \mathbf { z } ) \end{aligned} k(x,z)​=(xTz)2=(x1​z1​+x2​z2​)2=x12​z12​+2x1​z1​x2​z2​+x22​z22​=(x12​,2 ​x1​x2​,x22​)(z12​,2 ​z1​z2​,z22​)T=ϕ(x)Tϕ(z)​但是这样判断一个核是否有效太麻烦,因此寻找一个更加方便的方法。核函数 k ( x , x ′ ) k \left( \mathbf { x } , \mathbf { x } ^ { \prime } \right) k(x,x′)是⼀个合法的核函数的充分必要条件是Gram矩阵(元素由 k ( x n , x m ) k \left( \mathbf { x } _ { n } , \mathbf { x } _ { m } \right) k(xn​,xm​)给出)在所有的集合 { x n } \left\{ \mathbf { x } _ { n } \right\} {xn​}的选择下都是半正定的(Shawe-Taylor and Cristianini, 2004)。
还有一些扩展的技巧

通过以上性质,可以构造出很多核函数 k ( x , x ′ ) = ( x T x ′ + c ) M k \left( \mathbf { x } , \mathbf { x } ^ { \prime } \right) = \left( \mathbf { x } ^ { \mathrm { T } } \mathbf { x } ^ { \prime } + c \right) ^ { M } k(x,x′)=(xTx′+c)M k ( x , x ′ ) = exp ⁡ ( − ∥ x − x ′ ∥ 2 / 2 σ 2 ) k \left( \mathbf { x } , \mathbf { x } ^ { \prime } \right) = \exp \left( - \left\| \mathbf { x } - \mathbf { x } ^ { \prime } \right\| ^ { 2 } / 2 \sigma ^ { 2 } \right) k(x,x′)=exp(−∥x−x′∥2/2σ2)在高斯核中不限于欧几里得度量,也可以将其再用核替换 k ( x , x ′ ) = exp ⁡ { − 1 2 σ 2 ( κ ( x , x ) + κ ( x ′ , x ′ ) − 2 κ ( x , x ′ ) ) } k \left( \boldsymbol { x } , \boldsymbol { x } ^ { \prime } \right) = \exp \left\{ - \frac { 1 } { 2 \sigma ^ { 2 } } \left( \kappa ( \boldsymbol { x } , \boldsymbol { x } ) + \kappa \left( \boldsymbol { x } ^ { \prime } , \boldsymbol { x } ^ { \prime } \right) - 2 \kappa \left( \boldsymbol { x } , \boldsymbol { x } ^ { \prime } \right) \right) \right\} k(x,x′)=exp{−2σ21​(κ(x,x)+κ(x′,x′)−2κ(x,x′))}

构造核的另⼀个强⼤的⽅法是从⼀个概率⽣成式模型开始构造(Haussler, 1999),这使得我们可以在⼀个判别式的框架中使⽤⽣成式模型。⽣成式模型可以⾃然地处理缺失数据,并且在隐马尔科夫模型的情况下,可以处理长度变化的序列。相反,判别式模型在判别式的任务中通常会⽐⽣成式模型的表现更好。于是,将这两种⽅法结合吸引了⼀些⼈的兴趣(Lasserre et al.,2006)。⼀种将⼆者结合的⽅法是使⽤⼀个⽣成式模型定义⼀个核,然后在判别式⽅法中使⽤这个核。 k ( x , x ′ ) = p ( x ) p ( x ′ ) k \left( \mathbf { x } , \mathbf { x } ^ { \prime } \right) = p ( \mathbf { x } ) p \left( \mathbf { x } ^ { \prime } \right) k(x,x′)=p(x)p(x′)很显然这个为有效核。它表明,如果两个输⼊ x \mathbf x x和 x ′ \mathbf x^′ x′都具有较⾼的概率,那么它们就是相似的。利用6.13和6.17扩展这个核 k ( x , x ′ ) = ∑ i p ( x ∣ i ) p ( x ′ ∣ i ) p ( i ) k \left( \mathbf { x } , \mathbf { x } ^ { \prime } \right) = \sum _ { i } p ( \mathbf { x } | i ) p \left( \mathbf { x } ^ { \prime } | i \right) p ( i ) k(x,x′)=i∑​p(x∣i)p(x′∣i)p(i)其中 i i i可以看作为隐变量,将求和换为积分,则 k ( x , x ′ ) = ∫ p ( x ∣ z ) p ( x ′ ∣ z ) p ( z ) d z k \left( \mathbf { x } , \mathbf { x } ^ { \prime } \right) = \int p ( \mathbf { x } | \mathbf { z } ) p \left( \mathbf { x } ^ { \prime } | \mathbf { z } \right) p ( \mathbf { z } ) \mathrm { d } \mathbf { z } k(x,x′)=∫p(x∣z)p(x′∣z)p(z)dz

另⼀个使⽤⽣成式模型定义核函数的⽅法被称为Fisher核(Jaakkola and Haussler, 1999)。考虑⼀个参数⽣成式模型 p ( x ∣ θ ) p ( \mathbf { x } | \boldsymbol { \theta } ) p(x∣θ),其中 θ \boldsymbol { \theta } θ表⽰参数的向量。⽬标是找到⼀个核,度量这个⽣成式模型的两个输⼊变量 x \mathbf x x和 x ′ \mathbf x^′ x′之间的相似性。Jaakkola and Haussler(1999)考虑关于 θ \boldsymbol { \theta } θ的梯度,它定义了“特征”空间的⼀个向量,这个特征空间的维度与 θ \boldsymbol { \theta } θ的维度相同。特别地,它们考虑Fisher得分 g ( θ , x ) = ∇ θ ln ⁡ p ( x ∣ θ ) \mathbf { g } ( \boldsymbol { \theta } , \mathbf { x } ) = \nabla _ { \boldsymbol { \theta } } \ln p ( \mathbf { x } | \boldsymbol { \theta } ) g(θ,x)=∇θ​lnp(x∣θ)则Fisher核 k ( x , x ′ ) = g ( θ , x ) T F − 1 g ( θ , x ′ ) k \left( \mathbf { x } , \mathbf { x } ^ { \prime } \right) = \mathbf { g } ( \boldsymbol { \theta } , \mathbf { x } ) ^ { \mathrm { T } } \mathbf { F } ^ { - 1 } \mathbf { g } \left( \boldsymbol { \theta } , \mathbf { x } ^ { \prime } \right) k(x,x′)=g(θ,x)TF−1g(θ,x′)其中Fisher information matrix F = E x [ g ( θ , x ) g ( θ , x ) T ] \mathbf { F } = \mathbb { E } _ { \mathbf { x } } \left[ \mathbf { g } ( \boldsymbol { \theta } , \mathbf { x } ) \mathbf { g } ( \boldsymbol { \theta } , \mathbf { x } ) ^ { \mathrm { T } } \right] F=Ex​[g(θ,x)g(θ,x)T]在实际中 F ≃ 1 N ∑ n = 1 N g ( θ , x n ) g ( θ , x n ) T \boldsymbol { F } \simeq \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \boldsymbol { g } \left( \boldsymbol { \theta } , \boldsymbol { x } _ { n } \right) g \left( \boldsymbol { \theta } , \boldsymbol { x } _ { n } \right) ^ { T } F≃N1​n=1∑N​g(θ,xn​)g(θ,xn​)T

6.3 Radial Basis Function Networks

在第3章,我们讨论了基于固定基函数的线性组合的回归模型,但是我们没有详细讨论可以取哪种形式的基函数。⼀种⼴泛使⽤的基函数是径向基函数(radial basis functions)。径向基函数中,每⼀个基函数只依赖于样本和中⼼ μ j \mu _ { j } μj​之间的径向距离(通常是欧⼏⾥得距离),即 ϕ j ( x ) = h ( ∥ x − μ j ∥ ) \phi _ { j } ( \mathbf { x } ) = h \left( \left\| \mathbf { x } - \boldsymbol { \mu } _ { j } \right\| \right) ϕj​(x)=h(∥∥​x−μj​∥∥​)。
rbf首先是针对于回归问题(内插问题),对于训练数据 { x 1 , . . . , x N } \{\mathbf x_1,...,\mathbf x_N\} {x1​,...,xN​}, { t 1 , . . . , t N } \{t_1,...,t_N\} {t1​,...,tN​}。目标是找到一个函数 f ( x n ) = t n f\left(\mathbf{x}_{n}\right)=t_{n} f(xn​)=tn​。可以这样做:将 f ( x n ) f\left(\mathbf{x}_{n}\right) f(xn​)表⽰为径向基函数的线性组合,每个径向基函数都以数据点为中⼼,即
f ( x ) = ∑ n = 1 N w n h ( ∥ x − x n ∥ ) f(\boldsymbol{x})=\sum_{n=1}^{N} w_{n} h\left(\left\|\boldsymbol{x}-\boldsymbol{x}_{n}\right\|\right) f(x)=n=1∑N​wn​h(∥x−xn​∥)以上可以利用LMS求解,但是数据往往存在噪声,因此会过拟合。对于RBF函数的研究有很多,下面将一一罗列出。

6.3.1 Nadaraya-Watson model

之前3.3.3得到 y ( x , m N ) = ∑ n = 1 N k ( x , x n ) t n y\left(\mathbf{x}, \mathbf{m}_{N}\right)=\sum_{n=1}^{N} k\left(\mathbf{x}, \mathbf{x}_{n}\right) t_{n} y(x,mN​)=n=1∑N​k(x,xn​)tn​其中 k ( x , x ′ ) = β ϕ ( x ) T S N ϕ ( x ′ ) k\left(\mathbf{x}, \mathbf{x}^{\prime}\right)=\beta \phi(\mathbf{x})^{\mathrm{T}} \mathbf{S}_{N} \phi\left(\mathbf{x}^{\prime}\right) k(x,x′)=βϕ(x)TSN​ϕ(x′)我们可以从核密度估计开始,以⼀个不同的⾓度研究核回归模型。对于训练数据集,我们利用Parzen density estimator建模联合概率密度 p ( x , t ) p(\mathbf{x}, t) p(x,t) p ( x , t ) = 1 N ∑ n = 1 N f ( x − x n , t − t n ) p(\mathbf{x}, t)=\frac{1}{N} \sum_{n=1}^{N} f\left(\mathbf{x}-\mathbf{x}_{n}, t-t_{n}\right) p(x,t)=N1​n=1∑N​f(x−xn​,t−tn​)那么最优 y ( x ) = E [ t ∣ x ] = ∫ − ∞ ∞ t p ( t ∣ x ) d t = ∫ t p ( x , t ) d t ∫ p ( x , t ) d t = ∑ n ∫ t f ( x − x n , t − t n ) d t ∑ m ∫ f ( x − x m , t − t m ) d t \begin{aligned} y(\mathbf{x}) &=\mathbb{E}[t | \mathbf{x}]=\int_{-\infty}^{\infty} t p(t | \mathbf{x}) \mathrm{d} t \\ &=\frac{\int t p(\mathbf{x}, t) \mathrm{d} t}{\int p(\mathbf{x}, t) \mathrm{d} t} \\ &=\frac{\sum_{n} \int t f\left(\mathbf{x}-\mathbf{x}_{n}, t-t_{n}\right) \mathrm{d} t}{\sum_{m} \int f\left(\mathbf{x}-\mathbf{x}_{m}, t-t_{m}\right) \mathrm{d} t} \end{aligned} y(x)​=E[t∣x]=∫−∞∞​tp(t∣x)dt=∫p(x,t)dt∫tp(x,t)dt​=∑m​∫f(x−xm​,t−tm​)dt∑n​∫tf(x−xn​,t−tn​)dt​​假设 ∫ − ∞ ∞ f ( x , t ) t d t = 0 \int_{-\infty}^{\infty} f(\mathbf{x}, t) t \mathrm{d} t=0 ∫−∞∞​f(x,t)tdt=0则 y ( x ) = ∑ n g ( x − x n ) t n ∑ m g ( x − x m ) = ∑ n k ( x , x n ) t n \begin{aligned} y(\mathbf{x}) &=\frac{\sum_{n} g\left(\mathbf{x}-\mathbf{x}_{n}\right) t_{n}}{\sum_{m} g\left(\mathbf{x}-\mathbf{x}_{m}\right)} \\ &=\sum_{n} k\left(\mathbf{x}, \mathbf{x}_{n}\right) t_{n} \end{aligned} y(x)​=∑m​g(x−xm​)∑n​g(x−xn​)tn​​=n∑​k(x,xn​)tn​​其中 k ( x , x n ) = g ( x − x n ) ∑ m g ( x − x m ) k\left(\mathbf{x}, \mathbf{x}_{n}\right)=\frac{g\left(\mathbf{x}-\mathbf{x}_{n}\right)}{\sum_{m} g\left(\mathbf{x}-\mathbf{x}_{m}\right)} k(x,xn​)=∑m​g(x−xm​)g(x−xn​)​ g ( x ) = ∫ − ∞ ∞ f ( x , t ) d t g(\mathbf{x})=\int_{-\infty}^{\infty} f(\mathbf{x}, t) \mathrm{d} t g(x)=∫−∞∞​f(x,t)dt以上就是Nadaraya-Watson model。对于⼀个局部核函数,它的性质为:给距离 x \mathbf x x较近的数据点 x n \mathbf x_n xn​较⾼的权重。可以发现 ∑ n = 1 N k ( x , x n ) = 1 \sum_{n=1}^{N} k\left(\mathbf{x}, \mathbf{x}_{n}\right)=1 n=1∑N​k(x,xn​)=1这个与第三章得到的约束一样。我们利用这个还可以得到条件概率分布 p ( t ∣ x ) = p ( t , x ) ∫ p ( t , x ) d t = ∑ n f ( x − x n , t − t n ) ∑ m ∫ f ( x − x m , t − t m ) d t p(t | \mathbf{x})=\frac{p(t, \mathbf{x})}{\int p(t, \mathbf{x}) \mathrm{d} t}=\frac{\sum_{n} f\left(\mathbf{x}-\mathbf{x}_{n}, t-t_{n}\right)}{\sum_{m} \int f\left(\mathbf{x}-\mathbf{x}_{m}, t-t_{m}\right) \mathrm{d} t} p(t∣x)=∫p(t,x)dtp(t,x)​=∑m​∫f(x−xm​,t−tm​)dt∑n​f(x−xn​,t−tn​)​

这个模型的⼀个明显的推⼴是允许形式更灵活的⾼斯分布作为其分量,例如让输⼊和⽬标值具有不同⽅差。

6.4 Gaussian Processes

在6.1中在非概率回归模型中引入了对偶形式。下面以概率的观点看这个问题。也就是高斯过程。

6.4.1 Linear regression revisited

考虑⼀个模型 M M M,它被定义为由向量 ϕ ( x ) \phi(\mathbf{x}) ϕ(x)的元素给出的 M M M个固定基函数的线性组合,即 y ( x ) = w T ϕ ( x ) y(\mathbf{x})=\mathbf{w}^{\mathrm{T}} \boldsymbol{\phi}(\mathbf{x}) y(x)=wTϕ(x)对权重引入先验 p ( w ) = N ( w ∣ 0 , α − 1 I ) p(\mathbf{w})=\mathcal{N}\left(\mathbf{w} | \mathbf{0}, \alpha^{-1} \mathbf{I}\right) p(w)=N(w∣0,α−1I)改写成矩阵形式 y = Φ w \mathbf{y}=\mathbf{\Phi} \mathbf{w} y=Φw其中 y \mathbf y y为高斯分布的线性组合,那么他就是个高斯分布,则 E [ y ] = Φ E [ w ] = 0 cov ⁡ [ y ] = E [ y y T ] = Φ E [ w w T ] Φ T = 1 α Φ Φ T = K \begin{aligned} \mathbb{E}[\mathbf{y}] &=\boldsymbol{\Phi} \mathbb{E}[\mathbf{w}]=\mathbf{0} \\ \operatorname{cov}[\mathbf{y}] &=\mathbb{E}\left[\mathbf{y} \mathbf{y}^{\mathrm{T}}\right]=\mathbf{\Phi} \mathbb{E}\left[\mathbf{w} \mathbf{w}^{\mathrm{T}}\right] \mathbf{\Phi}^{\mathrm{T}}=\frac{1}{\alpha} \mathbf{\Phi} \mathbf{\Phi}^{\mathrm{T}}=\mathbf{K} \end{aligned} E[y]cov[y]​=ΦE[w]=0=E[yyT]=ΦE[wwT]ΦT=α1​ΦΦT=K​其中 K n m = k ( x n , x m ) = 1 α ϕ ( x n ) T ϕ ( x m ) K_{n m}=k\left(\mathbf{x}_{n}, \mathbf{x}_{m}\right)=\frac{1}{\alpha} \phi\left(\mathbf{x}_{n}\right)^{\mathrm{T}} \boldsymbol{\phi}\left(\mathbf{x}_{m}\right) Knm​=k(xn​,xm​)=α1​ϕ(xn​)Tϕ(xm​)这个模型给我们提供了⾼斯过程的⼀个具体的例⼦。通常来说,⾼斯过程被定义为函数 y ( x ) y(\mathbf{x}) y(x)上的⼀个概率分布,使得在任意点集 x 1 , … , x N \mathbf{x}_{1}, \dots, \mathbf{x}_{N} x1​,…,xN​处计算的 y ( x ) y(\mathbf{x}) y(x)的值的集合联合起来服从⾼斯分布。在输⼊向量 x \mathbf x x是⼆维的情况下,这也可以被称为⾼斯随机场(Gaussian random field)。更⼀般地,可以⽤⼀种合理的⽅式为 y ( x 1 ) , … , y ( x N ) y\left(\mathbf{x}_{1}\right), \ldots, y\left(\mathbf{x}_{N}\right) y(x1​),…,y(xN​)赋予⼀个联合的概率分布,来确定⼀个随机过程(stochastic process) y ( x ) y(\mathbf{x}) y(x)。
⾼斯随机过程的⼀个关键点是 N N N个变量 y 1 , … , y N y_{1}, \ldots, y_{N} y1​,…,yN​上的联合概率分布完全由⼆阶统计(即均值和协⽅差)确定。在⼤部分应⽤中,我们关于 y ( x ) y(\mathbf{x}) y(x)的均值没有任何先验的知识,因此根据对称性,我们令其等于零。这等价于基函数的观点中,令权值 p ( w ∣ α ) p(\mathbf{w} | \alpha) p(w∣α)的先验概率分布的均值等于零。之后,⾼斯过程的确定通过给定两个 x \mathbf x x处的函数值 y ( x ) y(\mathbf{x}) y(x)的协⽅差来完成。这个协⽅差由核函数确定 E [ y ( x n ) y ( x m ) ] = k ( x n , x m ) \mathbb{E}\left[y\left(\mathbf{x}_{n}\right) y\left(\mathbf{x}_{m}\right)\right]=k\left(\mathbf{x}_{n}, \mathbf{x}_{m}\right) E[y(xn​)y(xm​)]=k(xn​,xm​)我们也可以直接定义核函数,⽽不是间接地通过选择基函数。图6.4给出了对于两个不同的核函数,由⾼斯过程产⽣的函数的样本。下图的第二个核函数为 k ( x , x ′ ) = exp ⁡ ( − θ ∣ x − x ′ ∣ ) k\left(x, x^{\prime}\right)=\exp \left(-\theta\left|x-x^{\prime}\right|\right) k(x,x′)=exp(−θ∣x−x′∣)

6.4.2 Gaussian processes for regression

为了把⾼斯过程模型应⽤于回归问题,我们需要考虑观测⽬标值的噪声,形式为 t n = y n + ϵ n t_{n}=y_{n}+\epsilon_{n} tn​=yn​+ϵn​其中 y n = y ( x n ) y_{n}=y\left(\mathbf{x}_{n}\right) yn​=y(xn​)。对于噪声可以定义为 p ( t n ∣ y n ) = N ( t n ∣ y n , β − 1 ) p\left(t_{n} | y_{n}\right)=\mathcal{N}\left(t_{n} | y_{n}, \beta^{-1}\right) p(tn​∣yn​)=N(tn​∣yn​,β−1) p ( t ∣ y ) = N ( t ∣ y , β − 1 I N ) p(\mathbf{t} | \mathbf{y})=\mathcal{N}\left(\mathbf{t} | \mathbf{y}, \beta^{-1} \mathbf{I}_{N}\right) p(t∣y)=N(t∣y,β−1IN​)其中 p ( y ) = N ( y ∣ 0 , K ) p(\mathbf{y})=\mathcal{N}(\mathbf{y} | \mathbf{0}, \mathbf{K}) p(y)=N(y∣0,K)确定 K \mathbf{K} K的核函数通常被选择成能够表⽰下⾯的性质: 对于相似的点 x n \mathbf x_n xn​和 x m \mathbf x_m xm​, 对应的值 y ( x n ) y\left(\mathbf{x}_{n}\right) y(xn​)和 y ( x m ) y\left(\mathbf{x}_{m}\right) y(xm​)的相关性要⼤于不相似的点。这⾥,相似性的概念取决于实际应⽤。
可以把 y \mathbf y y积分 p ( t ) = ∫ p ( t ∣ y ) p ( y ) d y = N ( t ∣ 0 , C ) p(\mathbf{t})=\int p(\mathbf{t} | \mathbf{y}) p(\mathbf{y}) \mathrm{d} \mathbf{y}=\mathcal{N}(\mathbf{t} | \mathbf{0}, \mathbf{C}) p(t)=∫p(t∣y)p(y)dy=N(t∣0,C)其中 C ( x n , x m ) = k ( x n , x m ) + β − 1 δ n m C\left(\mathbf{x}_{n}, \mathbf{x}_{m}\right)=k\left(\mathbf{x}_{n}, \mathbf{x}_{m}\right)+\beta^{-1} \delta_{n m} C(xn​,xm​)=k(xn​,xm​)+β−1δnm​对于⾼斯过程回归,⼀个⼴泛使⽤的核函数的形式为指数项的⼆次型加上常数和线性项,即 k ( x n , x m ) = θ 0 exp ⁡ { − θ 1 2 ∥ x n − x m ∥ 2 } + θ 2 + θ 3 x n T x m k\left(\mathbf{x}_{n}, \mathbf{x}_{m}\right)=\theta_{0} \exp \left\{-\frac{\theta_{1}}{2}\left\|\mathbf{x}_{n}-\mathbf{x}_{m}\right\|^{2}\right\}+\theta_{2}+\theta_{3} \mathbf{x}_{n}^{\mathrm{T}} \mathbf{x}_{m} k(xn​,xm​)=θ0​exp{−2θ1​​∥xn​−xm​∥2}+θ2​+θ3​xnT​xm​以此核函数为先验抽样函数为


⽬前为⽌,我们已经使⽤⾼斯过程的观点来构建数据点的集合上的联合概率分布的模型。然⽽,我们在回归问题中的⽬标是在给定⼀组训练数据的情况下,对新的输⼊变量预测⽬标变量的值。让我们假设 t N = ( t 1 , … , t N ) T \mathbf{t}_{N}=\left(t_{1}, \dots, t_{N}\right)^{\mathrm{T}} tN​=(t1​,…,tN​)T ,对应于输⼊值 x 1 , … , x N \mathbf{x}_{1}, \dots, \mathbf{x}_{N} x1​,…,xN​,组成观测训练集,并且我们的⽬标是对于新的输⼊向量 x N + 1 \mathbf{x}_{N+1} xN+1​预测⽬标变量 t N + 1 t_{N+1} tN+1​。这要求我们计算预测分布 p ( t N + 1 ∣ t N ) p\left(t_{N+1} | \mathbf{t}_{N}\right) p(tN+1​∣tN​)。注意,这个分布还要以变量 x 1 , … , x N \mathbf{x}_{1}, \dots, \mathbf{x}_{N} x1​,…,xN​和 x N + 1 \mathbf{x}_{N+1} xN+1​为条件。但是为了记号的简介,我们不会显式地写出这些条件变量。 p ( t N + 1 ) = N ( t N + 1 ∣ 0 , C N + 1 ) p\left(\mathbf{t}_{N+1}\right)=\mathcal{N}\left(\mathbf{t}_{N+1} | \mathbf{0}, \mathbf{C}_{N+1}\right) p(tN+1​)=N(tN+1​∣0,CN+1​)其中 C N + 1 = ( C N k k T c ) \mathbf{C}_{N+1}=\left(\begin{array}{cc}{\mathbf{C}_{N}} & {\mathbf{k}} \\ {\mathbf{k}^{\mathrm{T}}} & {c}\end{array}\right) CN+1​=(CN​kT​kc​)根据高斯分布的性质可得 m ( x N + 1 ) = k T C N − 1 t σ 2 ( x N + 1 ) = c − k T C N − 1 k \begin{aligned} m\left(\mathbf{x}_{N+1}\right) &=\mathbf{k}^{\mathrm{T}} \mathbf{C}_{N}^{-1} \mathbf{t} \\ \sigma^{2}\left(\mathbf{x}_{N+1}\right) &=c-\mathbf{k}^{\mathrm{T}} \mathbf{C}_{N}^{-1} \mathbf{k} \end{aligned} m(xN+1​)σ2(xN+1​)​=kTCN−1​t=c−kTCN−1​k​可见高斯过程需要计算一个矩阵的逆,对于大数据来说就很复杂。因此有很多近似的方式。

6.4.3 Learning the hyperparameters

⾼斯过程模型的预测部分依赖于协⽅差函数的选择。在实际应⽤中,我们不固定协⽅差函数,⽽是更喜欢使⽤⼀组带有参数的函数,然后从数据中推断参数的值。这些参数控制了相关性的长度缩放以及噪声的精度等等,对应于标准参数模型的超参数。
最直观的方法是最大似然点估计 ln ⁡ p ( t ∣ θ ) = − 1 2 ln ⁡ ∣ C N ∣ − 1 2 t T C N − 1 t − N 2 ln ⁡ ( 2 π ) \ln p(\mathbf{t} | \boldsymbol{\theta})=-\frac{1}{2} \ln \left|\mathbf{C}_{N}\right|-\frac{1}{2} \mathbf{t}^{\mathrm{T}} \mathbf{C}_{N}^{-1} \mathbf{t}-\frac{N}{2} \ln (2 \pi) lnp(t∣θ)=−21​ln∣CN​∣−21​tTCN−1​t−2N​ln(2π)然后关于 θ \boldsymbol \theta θ进行梯度下降 ∂ ∂ θ i ln ⁡ p ( t ∣ θ ) = − 1 2 Tr ⁡ ( C N − 1 ∂ C N ∂ θ i ) + 1 2 t T C N − 1 ∂ C N ∂ θ i C N − 1 t \frac{\partial}{\partial \theta_{i}} \ln p(\mathbf{t} | \boldsymbol{\theta})=-\frac{1}{2} \operatorname{Tr}\left(\mathbf{C}_{N}^{-1} \frac{\partial \mathbf{C}_{N}}{\partial \theta_{i}}\right)+\frac{1}{2} \mathbf{t}^{\mathrm{T}} \mathbf{C}_{N}^{-1} \frac{\partial \mathbf{C}_{N}}{\partial \theta_{i}} \mathbf{C}_{N}^{-1} \mathbf{t} ∂θi​∂​lnp(t∣θ)=−21​Tr(CN−1​∂θi​∂CN​​)+21​tTCN−1​∂θi​∂CN​​CN−1​t同样地,可以引入 θ \boldsymbol \theta θ的先验,然后精确求解后验是不可能的,因此可以采用一些近似的手段。一般来说,高斯过程回归中的模型噪声是一个常数 β \beta β,有些时候这个值与 x \mathbf x x有关,因此可以引入第二个高斯过程回归得到 β ( x ) \beta(\mathbf x) β(x)。

6.4.4 Automatic relevance determination

在前⼀节⾥,我们看到最⼤似然⽅法如何被⽤于确定⾼斯过程中的长度缩放参数的值。通过为每个输⼊变量整合⼀个单独的参数,这种⽅法可以很有⽤地推⼴(Rasmussen and Williams,2006)。正如我们将看到的那样,这样做的结果是,通过最⼤似然⽅法进⾏的参数最优化,能够将不同输⼊的相对重要性从数据中推断出来。这是⾼斯过程中的⾃动相关性确定(automatic relevance detemination)或者ARD的⼀个例⼦。它起源于神经⽹络的框架(MacKay, 1994; Neal,1996)。这种⽅法倾向于选择合适的输⼊的机理在7.2.2节讨论。
考虑⼆维输⼊空间 x = ( x 1 , x 2 ) \mathbf{x}=\left(x_{1}, x_{2}\right) x=(x1​,x2​),有⼀个下⾯形式的核函数 k ( x , x ′ ) = θ 0 exp ⁡ { − 1 2 ∑ i = 1 2 η i ( x i − x i ′ ) 2 } k\left(\mathbf{x}, \mathbf{x}^{\prime}\right)=\theta_{0} \exp \left\{-\frac{1}{2} \sum_{i=1}^{2} \eta_{i}\left(x_{i}-x_{i}^{\prime}\right)^{2}\right\} k(x,x′)=θ0​exp{−21​i=1∑2​ηi​(xi​−xi′​)2}

当某个维度的参数值越小,则对该维度的输入越不敏感。也就是说通过这个参数,可以对无用的参数进行删减。
图6.10使⽤⼀个具有三个输⼊ x 1 , x 2 x_{1}, x_{2} x1​,x2​ and x 3 x_{3} x3​的简单⼈造数据集来说明ARD(Nabney, 2002)。⽬标变量 t t t的⽣成⽅式为:从⼀个⾼斯分布中采样100个 x 1 x_{1} x1​,计算函数 sin ⁡ ( 2 π x 1 ) \sin \left(2 \pi x_{1}\right) sin(2πx1​),然后加上添加上⾼斯噪声。 x 2 x_2 x2​的值通过复制对应的 x 1 x_1 x1​然后添加噪声的⽅式获得, x 3 x_3 x3​的值从⼀个独⽴的⾼斯分布中采样。因此, x 1 x_1 x1​很好地预测了 t t t, x 2 x_2 x2​对 t t t的预测的噪声更⼤, x 3 x_3 x3​与 t t t之间只有偶然的相关性。⼀个带有ARD参数 η 1 , η 2 , η 3 \eta_{1}, \eta_{2}, \eta_{3} η1​,η2​,η3​的⾼斯过程的边缘似然函数使⽤放缩的共轭梯度算法进⾏最优化。从图6.10中,我们看到 η 1 \eta_{1} η1​收敛到了⼀个相对较⼤的值, η 2 \eta_{2} η2​收敛到了⼀个⼩得多的值, η 3 \eta_{3} η3​变得⾮常⼩,表明 x 3 x_3 x3​与预测 t t t⽆关。

ARD框架很容易整合到指数-⼆次核中,得到下⾯形式的核函数,它对于⼀⼤类将⾼斯过程应⽤于回归问题的实际应⽤都很有帮助。
k ( x n , x m ) = θ 0 exp ⁡ { − 1 2 ∑ i = 1 D η i ( x n i − x m i ) 2 } + θ 2 + θ 3 ∑ i = 1 D x n i x m i k\left(\mathbf{x}_{n}, \mathbf{x}_{m}\right)=\theta_{0} \exp \left\{-\frac{1}{2} \sum_{i=1}^{D} \eta_{i}\left(x_{n i}-x_{m i}\right)^{2}\right\}+\theta_{2}+\theta_{3} \sum_{i=1}^{D} x_{n i} x_{m i} k(xn​,xm​)=θ0​exp{−21​i=1∑D​ηi​(xni​−xmi​)2}+θ2​+θ3​i=1∑D​xni​xmi​

6.4.5 Gaussian processes for classification

在分类的概率⽅法中,我们的⽬标是在给定⼀组训练数据的情况下,对于⼀个新的输⼊向量,为⽬标变量的后验概率建模。这些概率⼀定位于区间 ( 0 , 1 ) (0, 1) (0,1)中,⽽⼀个⾼斯过程模型做出的预测位于整个实数轴上。然⽽,我们可以很容易地调整⾼斯过程,使其能够处理分类问题。⽅法为:使⽤⼀个恰当的⾮线性激活函数,将⾼斯过程的输出进⾏变换。
考虑一个二分类问题, t ∈ { 0 , 1 } t \in\{0,1\} t∈{0,1},利用定义函数 a ( x ) a(\mathbf{x}) a(x)符合高斯过程,然后利用sigmoid函数转化为 y = σ ( a ) y=\sigma(a) y=σ(a),此时就能符合概率区间。

则 p ( t ∣ a ) = σ ( a ) t ( 1 − σ ( a ) ) 1 − t p(t | a)=\sigma(a)^{t}(1-\sigma(a))^{1-t} p(t∣a)=σ(a)t(1−σ(a))1−t我们的目标是在给定训练数据 x 1 , … , x N \mathbf{x}_{1}, \dots, \mathbf{x}_{N} x1​,…,xN​和 t = ( t 1 , … , t N ) T \mathbf{t}=\left(t_{1}, \dots, t_{N}\right)^{\mathrm{T}} t=(t1​,…,tN​)T,在新数据 x N + 1 \mathbf{x}_{N+1} xN+1​ with target value t N + 1 t_{N+1} tN+1​。利用训练数据预测新数据 p ( t N + 1 ∣ t ) p\left(t_{N+1} | \mathbf{t}\right) p(tN+1​∣t),对 a ( x ) a(\mathbf x) a(x)引入高斯过程先验 p ( a N + 1 ) = N ( a N + 1 ∣ 0 , C N + 1 ) p\left(\mathbf{a}_{N+1}\right)=\mathcal{N}\left(\mathbf{a}_{N+1} | \mathbf{0}, \mathbf{C}_{N+1}\right) p(aN+1​)=N(aN+1​∣0,CN+1​)与回归的情形不同,协⽅差矩阵不再包含噪声项,因为我们假设所有的训练数据点都被正确标记。然⽽,由于数值计算的原因,更⽅便的做法是引⼊⼀个由参数 ν \nu ν控制的类似噪声的项,它确保了协⽅差矩阵是正定的。因此协⽅差矩阵 C N + 1 \mathbf{C}_{N+1} CN+1​的元素为 C ( x n , x m ) = k ( x n , x m ) + ν δ n m C\left(\mathbf{x}_{n}, \mathbf{x}_{m}\right)=k\left(\mathbf{x}_{n}, \mathbf{x}_{m}\right)+\nu \delta_{n m} C(xn​,xm​)=k(xn​,xm​)+νδnm​其中 k ( x n , x m ) k\left(\mathbf{x}_{n}, \mathbf{x}_{m}\right) k(xn​,xm​)为核函数,其参数为 θ \theta θ,可以从训练数据集中训练到。而 ν \nu ν为预先给定的数。
则 p ( t N + 1 = 1 ∣ t N ) = ∫ p ( t N + 1 = 1 ∣ a N + 1 ) p ( a N + 1 ∣ t N ) d a N + 1 p\left(t_{N+1}=1 | \mathbf{t}_{N}\right)=\int p\left(t_{N+1}=1 | a_{N+1}\right) p\left(a_{N+1} | \mathbf{t}_{N}\right) \mathrm{d} a_{N+1} p(tN+1​=1∣tN​)=∫p(tN+1​=1∣aN+1​)p(aN+1​∣tN​)daN+1​其中 p ( t N + 1 = 1 ∣ a N + 1 ) = σ ( a N + 1 ) p\left(t_{N+1}=1 | a_{N+1}\right)=\sigma\left(a_{N+1}\right) p(tN+1​=1∣aN+1​)=σ(aN+1​)。以上的积分是没有解析解的。只能通过近似的方法。对于sigmoid与高斯的积分,在4.5.2中有 ∫ σ ( a ) N ( a ∣ μ , σ 2 ) d a ≃ σ ( κ ( σ 2 ) μ ) \int \sigma(a) \mathcal{N}\left(a | \mu, \sigma^{2}\right) \mathrm{d} a \simeq \sigma\left(\kappa\left(\sigma^{2}\right) \mu\right) ∫σ(a)N(a∣μ,σ2)da≃σ(κ(σ2)μ)那么只要把后验 p ( a N + 1 ∣ t N ) p\left(a_{N+1} | \mathbf{t}_{N}\right) p(aN+1​∣tN​)近似为高斯即可。

6.4.6 Laplace approximation

p ( a N + 1 ∣ t N ) = ∫ p ( a N + 1 , a N ∣ t N ) d a N = 1 p ( t N ) ∫ p ( a N + 1 , a N ) p ( t N ∣ a N + 1 , a N ) d a N = 1 p ( t N ) ∫ p ( a N + 1 ∣ a N ) p ( a N ) p ( t N ∣ a N ) d a N = ∫ p ( a N + 1 ∣ a N ) p ( a N ∣ t N ) d a N \begin{aligned} p\left(a_{N+1} | \mathbf{t}_{N}\right) &=\int p\left(a_{N+1}, \mathbf{a}_{N} | \mathbf{t}_{N}\right) \mathrm{d} \mathbf{a}_{N} \\ &=\frac{1}{p\left(\mathbf{t}_{N}\right)} \int p\left(a_{N+1}, \mathbf{a}_{N}\right) p\left(\mathbf{t}_{N} | a_{N+1}, \mathbf{a}_{N}\right) \mathrm{d} \mathbf{a}_{N} \\ &=\frac{1}{p\left(\mathbf{t}_{N}\right)} \int p\left(a_{N+1} | \mathbf{a}_{N}\right) p\left(\mathbf{a}_{N}\right) p\left(\mathbf{t}_{N} | \mathbf{a}_{N}\right) \mathrm{d} \mathbf{a}_{N} \\ &=\int p\left(a_{N+1} | \mathbf{a}_{N}\right) p\left(\mathbf{a}_{N} | \mathbf{t}_{N}\right) \mathrm{d} \mathbf{a}_{N} \end{aligned} p(aN+1​∣tN​)​=∫p(aN+1​,aN​∣tN​)daN​=p(tN​)1​∫p(aN+1​,aN​)p(tN​∣aN+1​,aN​)daN​=p(tN​)1​∫p(aN+1​∣aN​)p(aN​)p(tN​∣aN​)daN​=∫p(aN+1​∣aN​)p(aN​∣tN​)daN​​而 p ( a N + 1 ∣ a N ) = N ( a N + 1 ∣ k T C N − 1 a N , c − k T C N − 1 k ) p\left(a_{N+1} | \mathbf{a}_{N}\right)=\mathcal{N}\left(a_{N+1} | \mathbf{k}^{\mathrm{T}} \mathbf{C}_{N}^{-1} \mathbf{a}_{N}, c-\mathbf{k}^{\mathrm{T}} \mathbf{C}_{N}^{-1} \mathbf{k}\right) p(aN+1​∣aN​)=N(aN+1​∣kTCN−1​aN​,c−kTCN−1​k)对于 p ( a N ∣ t N ) p\left(\mathbf{a}_{N} | \mathbf{t}_{N}\right) p(aN​∣tN​)采用拉普拉斯近似。似然为 p ( t N ∣ a N ) = ∏ n = 1 N σ ( a n ) t n ( 1 − σ ( a n ) ) 1 − t n = ∏ n = 1 N e a n t n σ ( − a n ) p\left(\mathbf{t}_{N} | \mathbf{a}_{N}\right)=\prod_{n=1}^{N} \sigma\left(a_{n}\right)^{t_{n}}\left(1-\sigma\left(a_{n}\right)\right)^{1-t_{n}}=\prod_{n=1}^{N} e^{a_{n} t_{n}} \sigma\left(-a_{n}\right) p(tN​∣aN​)=n=1∏N​σ(an​)tn​(1−σ(an​))1−tn​=n=1∏N​ean​tn​σ(−an​)则寻找后验的众数 Ψ ( a N ) = ln ⁡ p ( a N ) + ln ⁡ p ( t N ∣ a N ) = − 1 2 a N T C N − 1 a N − N 2 ln ⁡ ( 2 π ) − 1 2 ln ⁡ ∣ C N ∣ + t N T a N − ∑ n = 1 N ln ⁡ ( 1 + e a n ) + const.  \begin{aligned} \Psi\left(\mathbf{a}_{N}\right)=& \ln p\left(\mathbf{a}_{N}\right)+\ln p\left(\mathbf{t}_{N} | \mathbf{a}_{N}\right) \\=&-\frac{1}{2} \mathbf{a}_{N}^{\mathrm{T}} \mathbf{C}_{N}^{-1} \mathbf{a}_{N}-\frac{N}{2} \ln (2 \pi)-\frac{1}{2} \ln \left|\mathbf{C}_{N}\right|+\mathbf{t}_{N}^{\mathrm{T}} \mathbf{a}_{N} \\ &-\sum_{n=1}^{N} \ln \left(1+e^{a_{n}}\right)+\text { const. } \end{aligned} Ψ(aN​)==​lnp(aN​)+lnp(tN​∣aN​)−21​aNT​CN−1​aN​−2N​ln(2π)−21​ln∣CN​∣+tNT​aN​−n=1∑N​ln(1+ean​)+ const. ​ ∇ Ψ ( a N ) = t N − σ N − C N − 1 a N \nabla \Psi\left(\mathbf{a}_{N}\right)=\mathbf{t}_{N}-\boldsymbol{\sigma}_{N}-\mathbf{C}_{N}^{-1} \mathbf{a}_{N} ∇Ψ(aN​)=tN​−σN​−CN−1​aN​上式令其为0,是解不出来的,其中 σ N \boldsymbol{\sigma}_{N} σN​为 σ ( a n ) \sigma\left(a_{n}\right) σ(an​)组成的向量,与 a n a_n an​有关。那么可以采用迭代的方式。我们还需要二阶导数 ∇ ∇ Ψ ( a N ) = − W N − C N − 1 \nabla \nabla \Psi\left(\mathbf{a}_{N}\right)=-\mathbf{W}_{N}-\mathbf{C}_{N}^{-1} ∇∇Ψ(aN​)=−WN​−CN−1​其中 W N \mathbf{W}_{N} WN​ is a diagonal matrix with elements σ ( a n ) ( 1 − σ ( a n ) ) \sigma\left(a_{n}\right)\left(1-\sigma\left(a_{n}\right)\right) σ(an​)(1−σ(an​))。可以证明海森矩阵 A = − ∇ ∇ Ψ ( a N ) \mathbf{A}=-\nabla \nabla \Psi\left(\mathbf{a}_{N}\right) A=−∇∇Ψ(aN​)为正定的,则有唯一的众数。采用迭代算法更新 w ( new  ) = w ( old  ) − H − 1 ∇ E ( w ) \mathbf{w}^{(\text { new })}=\mathbf{w}^{(\text { old })}-\mathbf{H}^{-1} \nabla E(\mathbf{w}) w( new )=w( old )−H−1∇E(w)则 a N n e w = C N ( I + W N C N ) − 1 { t N − σ N + W N a N } \mathbf{a}_{N}^{\mathrm{new}}=\mathbf{C}_{N}\left(\mathbf{I}+\mathbf{W}_{N} \mathbf{C}_{N}\right)^{-1}\left\{\mathbf{t}_{N}-\boldsymbol{\sigma}_{N}+\mathbf{W}_{N} \mathbf{a}_{N}\right\} aNnew​=CN​(I+WN​CN​)−1{tN​−σN​+WN​aN​}迭代至 a N ⋆ \boldsymbol{a}_{N}^{\star} aN⋆​,再计算海森矩阵 H = − ∇ ∇ Ψ ( a N ) = W N + C N − 1 \mathbf{H}=-\nabla \nabla \Psi\left(\mathbf{a}_{N}\right)=\mathbf{W}_{N}+\mathbf{C}_{N}^{-1} H=−∇∇Ψ(aN​)=WN​+CN−1​最后得到的近似高斯分布为 q ( a N ) = N ( a N ∣ a N ⋆ , H − 1 ) q\left(\mathbf{a}_{N}\right)=\mathcal{N}\left(\mathbf{a}_{N} | \mathbf{a}_{N}^{\star}, \mathbf{H}^{-1}\right) q(aN​)=N(aN​∣aN⋆​,H−1)则最终积分后为 E [ a N + 1 ∣ t N ] = k T ( t N − σ N ) var ⁡ [ a N + 1 ∣ t N ] = c − k T ( W N − 1 + C N ) − 1 k \begin{aligned} \mathbb{E}\left[a_{N+1} | \mathbf{t}_{N}\right] &=\mathbf{k}^{\mathrm{T}}\left(\mathbf{t}_{N}-\boldsymbol{\sigma}_{N}\right) \\ \operatorname{var}\left[a_{N+1} | \mathbf{t}_{N}\right] &=c-\mathbf{k}^{\mathrm{T}}\left(\mathbf{W}_{N}^{-1}+\mathbf{C}_{N}\right)^{-1} \mathbf{k} \end{aligned} E[aN+1​∣tN​]var[aN+1​∣tN​]​=kT(tN​−σN​)=c−kT(WN−1​+CN​)−1k​再采用sigmoid与高斯的积分就能得到 p ( t N + 1 = 1 ∣ t N ) p\left(t_{N+1}=1 | \mathbf{t}_{N}\right) p(tN+1​=1∣tN​)的分布。
对于核函数中的参数仍然可以采用最大似然的方式去优化 p ( t N ∣ θ ) = ∫ p ( t N ∣ a N ) p ( a N ∣ θ ) d a N p\left(\mathbf{t}_{N} | \boldsymbol{\theta}\right)=\int p\left(\mathbf{t}_{N} | \mathbf{a}_{N}\right) p\left(\mathbf{a}_{N} | \boldsymbol{\theta}\right) \mathrm{d} \mathbf{a}_{N} p(tN​∣θ)=∫p(tN​∣aN​)p(aN​∣θ)daN​

6.4.7 Connection to neural networks

PRML学习总结(6)——Kernel Methods相关推荐

  1. cs224w(图机器学习)2021冬季课程学习笔记2: Traditional Methods for ML on Graphs

    诸神缄默不语-个人CSDN博文目录 cs224w(图机器学习)2021冬季课程学习笔记集合 文章目录 1. 章节前言 2. Traditional Feature-based Methods: Nod ...

  2. PRML学习总结(8)——Graphical Models

    PRML学习总结(8)--Graphical Models 8.1 Bayesian Networks 8.1.1 Example: Polynomial regression 8.1.2 Gener ...

  3. PRML学习总结(5)——Neural Networks

    PRML学习总结(5)--Neural Networks 5.1 Feed-forward Network Functions 5.1.1 Weight-space symmetries 5.2 Ne ...

  4. 模式识别 | PRML Chapter 7 Sparse Kernel Machines

    PRML Chapter 7 Sparse Kernel Machines 7.1 Maximum Margin Classifiers The two-class classification pr ...

  5. 统计学习导论 Chapter8 -- Tree-Based Methods

    Book: An Introduction to Statistical Learning with Applications in R http://www-bcf.usc.edu/~gareth/ ...

  6. matlab求logistics映射 的le_高维映射 与 核方法(Kernel Methods)

    高维映射跟核方法的概念很容易混淆. 高维映射通过将样本从原始空间映射到一个更高维的特征空间,从而解决了低纬下难以解决的问题. 核方法往往跟高维映射配合使用,可以看做是一种技巧,可以通过它来避免这种映射 ...

  7. 论文笔记:联邦学习——Federated Learning: Challenges, Methods, and Future Directions

    Federated Learning: Challenges, Methods, and Future Directions 论文链接: link Federated Learning: Challe ...

  8. 统计学习导论 Chapter5 -- Resampling Methods

    Book: An Introduction to Statistical Learning with Applications in R http://www-bcf.usc.edu/~gareth/ ...

  9. 台湾大学林轩田机器学习技法课程学习笔记5 -- Kernel Logistic Regression

    红色石头的个人网站:redstonewill.com 上节课我们主要介绍了Soft-Margin SVM,即如果允许有分类错误的点存在,那么在原来的Hard-Margin SVM中添加新的惩罚因子C, ...

最新文章

  1. 自动禁止ssh的root登陆
  2. WPF Interaction框架简介(一)——Behavior
  3. 机器学习算法及实战——朴素贝叶斯
  4. 如何使用代码给product创建distribution chain
  5. python批量识别图中文字自动命名_python实现批量命名照片
  6. mysql 异步复制建立过程_mysql生产环境高可用---基于GTID异步复制项目实施
  7. wordpress主题-一款功能强大的综合类型wordpress模板
  8. C语言学习笔记---数组和指针的区别
  9. Windows/Linux下获取当前线程的ID号
  10. php 中的全局变量的理解
  11. Mqtt客户端与服务端通讯
  12. 单片机c语言实验报告心得,单片机实习心得体会
  13. 视频二维码在线生成器怎么用?
  14. Sonarqube 扫描maven项目
  15. 数字8(eight )题解
  16. 第二部分 音频压缩编码
  17. 电脑黑屏显示重新连接服务器,电脑黑屏怎么处理(电脑上显示器黑屏的处理方法)...
  18. python刷今日头条访问量_Python 自动刷博客浏览量实例代码
  19. 南方暴雨破纪录,路上的车慢慢开,太急要往河里栽
  20. 思维题 URAL 1409 Two Gangsters

热门文章

  1. JS闭包函数和回调函数
  2. 清华研究生情侣发SCI、做实验,毕业后勇敢离京选择小城市
  3. IEEE之后,学术政治化会成为人类的“潘多拉魔盒”吗?
  4. Docker容器Removal In Progress删除方案
  5. 求超定方程组最小二乘解的三种方法
  6. 【马仔创业记】一只猴子的创业独白(5)心理咨询行业痛点分析
  7. 亚信安全与新华三达成战略合作联手打造“更安全”的云数据中心
  8. C++ 文件的随机读写
  9. 第4章 虚拟机性能监控与故障处理工具
  10. 物尽其用——小米手机2/2S合并分区刷机方法