确定超平面所需条件
Show that, irrespective of the dimensionality of the data space, a data set consisting of just two data points (call them x(1) and x(2), one from each class) is sufficient to determine the maximum-margin hyperplane. Fully explain your answer, including giving an explicit formula for the solution to the hard margin SVM (i.e., w) as a function of x(1) and x(2).
Answer:
证明给定样本 x(1),x(2) ,能求出线性 SVM 分类器的参数即可。
αmaxi=1∑nαi−21i,j=1∑ny(i)y(j)αiαj(x(i))Tx(j)s.t.αi≥0,i=1,…,n,i=1∑nαiy(i)=0
将样本代入可得:
αmax(α1+α2−21α12∣∣x(1)∣∣22+α1α2(x(1))Tx(2)−21α22∣∣x(2)∣∣22)s.t.α1>0,α2>0,α1−α2=0
将 α1=α2 代入:
L(α1)=α1max(2α1−21α12∣∣x(1)∣∣22)+α12(x(1))Tx(2)−21α12∣∣x(2)∣∣22)
令 ∂α1∂L(α1)=2−α1∣∣x(1)∣∣22+2α1(x(1))Tx(2)−α1∣∣x(2)∣∣22=0 ,可得:
α1α2w∗b=∣∣x(1)∣∣22−2(x(1))Tx(2)+∣∣x(2)∣∣222=∣∣x(1)−x(2)∣∣222=α1=∣∣x(1)−x(2)∣∣222=α1x(1)−α2x(2)=∣∣x(1)−x(2)∣∣222(x(1)−x(2))=1−(α1(x(1))Tx(1)−α2(x(2))Tx(1))=1−∣∣x(1)−x(2)∣∣222((x(1))Tx(1)−(x(2))Tx(1)))
高斯核可以转化为无限维向量内积
Gaussian kernel takes the form:
k(x,x′)=exp(−2σ2∣∣x−x′∣∣2)
Try to show that the Gaussian kernel can be expressed as the inner product of an infinite-dimensional feature vector.
Hint: Making use of the following expansion, and then expanding the middle factor as a power series.
k(x,z)=exp(−2σ2xTx)exp(σ2xTz)exp(−2σ2(z)Tz)
Answer:
将中间项 exp(σ2xTz) 用泰勒级数展开:
exp(σ2xTz)=exp(σ2∑i=1dxizi)=n=0∑∞n!(σ2xTz)n=(1,1!1,2!1,⋯)((σ2xTz)0,(σ2xTz)1,(σ2xTz)2,⋯)T
代入 k(x,z) 得:
k(x,z)=exp(−2σ2xTx)[(1,1!1,2!1,⋯)((σ2xTz)0,(σ2xTz)1,(σ2xTz)2,⋯)T]exp(−2σ2(z)Tz)=[exp(−2σ2xTx)(1,1!1,2!1,⋯)][exp(−2σ2(z)Tz)((σ2xTz)0,(σ2xTz)1,(σ2xTz)2,⋯)]T