公式输入请参考:
在线Latex公式
定理1
一个光滑函数(smooth function)f满足L-Lipschitz条件,则对于任意
x,y∈Rd,我们有:
∣∣▽f(x)−▽f(y)∣∣≤L∣∣x−y∣∣(定理1)
这里的L是常数。
用线性回归为例,先写出线性回归的损失函数:
L=n1∣∣Xw−y∣∣2
这里X是训练数据,w是参数
现在求:
∣∣▽f(w1)−▽f(w2)∣∣=n2∣∣XT(Xw1−y)−XT(Xw2−y)∣∣=n2∣∣XTX(w1−w2)∣∣≤n2∣∣XTX∣∣⋅∣∣(w1−w2)∣∣
由于X是训练数据,是已知的。所以
∣∣XTX∣∣相当于L-Lipschitz中的常数项L。
定理2
一个光滑函数(smooth function)f满足L-Lipschitz条件,并且是凸函数,则对于任意
x,y∈Rd,我们有:
f(y)≤f(x)+▽f(x)(y−x)+2L∣∣y−x∣∣2(定理2)
这里的L是常数。
证明:
根据积分的性质有:
h(x):h(1)=h(0)+∫01h′(τ)dτ(1)
自己定义(为什么要这样定义不知道):
h(τ)=f(x+τ(y−x))
然后有:
h(1)=f(y),h(0)=f(x)
把公式1带入上面:
f(y)=f(x)+∫01h′(τ)dτ
把求导看做是复合函数求导即可:
f(y)=f(x)+∫01▽f(x+τ(y−x))(y−x)dτ
加一项
▽f(x)(y−x),积分里面减一项
▽f(x)(y−x)
f(y)=f(x)+▽f(x)(y−x)+∫01(▽f(x+τ(y−x))−▽f(x))(y−x)dτ
根据前面的定理1
f(y)=f(x)+▽f(x)(y−x)+∫01(▽f(x+τ(y−x))−▽f(x))(y−x)dτ≤f(x)+▽f(x)(y−x)+∫01L∣∣τ(y−x)∣∣∣∣y−x∣∣dτ
后面那个
∣∣y−x∣∣是根据
ab≤∣a∣∣b∣性质得到的,化简,积分后得:
f(y)≤f(x)+▽f(x)(y−x)+2L∣∣y−x∣∣2
证明完毕。
推论1
根据定理2,把
f(xi+1)看做
f(y),把
f(xi)看做
f(x):
f(xi+1)≤f(xi)+▽f(xi)(xi+1−xi)+2L∣∣xi+1−xi∣∣2
由于:
f(xi+1)=f(xi)−ηt▽f(xi)→f(xi+1)−f(xi)=−ηt▽f(xi)
所以有:
f(xi+1)≤f(xi)+▽f(xi)(−1)ηt▽f(xi)+2Lηt2▽f(xi)2
f(xi+1)≤f(xi)−ηt∣∣▽f(xi)∣∣2+2Lηt2∣∣▽f(xi)∣∣2
f(xi+1)≤f(xi)−ηt(1−2Lηt)∣∣▽f(xi)∣∣2(1)
补充说明:Convergence Analysis of Gradient Descent
迭代式的梯度下降的迭代次数的收敛分析
定理
假设函数满足L-Lipschitz条件(条件1),并且是凸函数(条件2),设定
x∗=argminf(x),那么对于步长
ηt≤L1(L是常数),满足:
.
f(xk)≤f(x∗)+2ηtk∣∣x0−x∗∣∣22
当我们迭代
k=εL∣∣x0−x∗∣∣22次之后我们可以保证得到。
其中
ε是approximation optimal value
x。(
ηt=L1)
xk是第k次迭代的x值。
xk慢慢接近
x∗也就是说不等式右边的最后一项是随着k变大慢慢变小的,如果变小的速度快,收敛速度就快。例如:
B方案的收敛速度比A要慢。
继续分析
2ηtk∣∣x0−x∗∣∣22,
x0是不变的,
x∗是最优解也是不变的,也就是分子是不变的;分母中
2ηt也是不变的,所以整个这一项随着k的变大慢慢变小。
而
k=εL∣∣x0−x∗∣∣22,相当于我们得到一个
ε的估计值,把这个带入上面:
.
2ηtk∣∣x0−x∗∣∣22=2ηtεL∣∣x0−x∗∣∣22∣∣x0−x∗∣∣22=2ηtLε
当我们把步长设置为:
ηt=L1→L=ηt1,带入上面:
2ηtLε=2ηtηt1ε=2ε
整理一下就是说,当
k=εL∣∣x0−x∗∣∣22时:
f(xk)≤f(x∗)+2ε
也写为:
f(xk)≤f(x∗)+O(ε)
当
ε很小的时候,
xk与
x∗差距也很小
根据补充说明中的一个条件:
ηt≤L1,把这个条件带入(1):
f(xi+1)≤f(xi)−ηt(1−2Lηt)∣∣▽f(xi)∣∣2≤f(xi)−ηt(1−2LL1)∣∣▽f(xi)∣∣2=f(xi)−2ηt∣∣▽f(xi)∣∣2
扫描二维码关注公众号,回复:
10985634 查看本文章
推论2
根据推论1:
f(xi+1)≤f(xi)−2ηt∣∣▽f(xi)∣∣2(2)
根据凸函数的First order convexity,(图片来源见水印https://zhuanlan.zhihu.com/p/57652786)
我们把(2)的第一项写开:
f(xi+1)≤f(xi)−2ηt∣∣▽f(xi)∣∣2≤f(x∗)+▽f(xi)(xi−x∗)−2ηt∣∣▽f(xi)∣∣2(3)
这里这个条件不知道哪里出来的,看形势就是梯度更新的公式:
xi+1=xi−ηt▽f(xi)→▽f(xi)=ηtxi−xi+1
xi+1=xi−ηt▽f(xi)→ηt▽f(xi)=xi−xi+1
带入(3):
f(xi+1)≤f(xi)−2ηt∣∣▽f(xi)∣∣2≤f(x∗)+ηtxi−xi+1(xi−x∗)−2ηt∣∣ηtxi−xi+1∣∣2=f(x∗)+ηtxi−xi+1(xi−x∗)−2ηt1∣∣xi−xi+1∣∣2=f(x∗)+2ηt2(xi2−xix∗−xixi+1+xi+1x∗)−2ηtxi2−2xixi+1+xi+12这里通过加一项减一项,最后整合为:=f(x∗)+2ηt1∣∣xi−x∗∣∣2−2ηt1(∣∣xi−x∗∣∣2−2ηt▽f(xi)(xi−x∗)+∣∣ηt▽f(xi)∣∣2)=f(x∗)+2ηt1∣∣xi−x∗∣∣2−2ηt1∣∣xi−x∗−ηt▽f(xi)∣∣2
=f(x∗)+2ηt1∣∣xi−x∗∣∣2−2ηt1∣∣xi+1−x∗∣∣2=f(x∗)+2ηt1(∣∣xi−x∗∣∣2−∣∣xi+1−x∗∣∣2)
推论2结束,结果如下:
f(xi+1)≤f(x∗)+2ηt1(∣∣xi−x∗∣∣2−∣∣xi+1−x∗∣∣2)(推论2)
推论3
将推论2移项:
f(xi+1)−f(x∗)≤2ηt1(∣∣xi−x∗∣∣2−∣∣xi+1−x∗∣∣2)
下面考虑从i=0开始看:
f(x1)−f(x∗)≤2ηt1(∣∣x0−x∗∣∣2−∣∣x1−x∗∣∣2)
f(x2)−f(x∗)≤2ηt1(∣∣x1−x∗∣∣2−∣∣x2−x∗∣∣2)
f(x3)−f(x∗)≤2ηt1(∣∣x2−x∗∣∣2−∣∣x3−x∗∣∣2)
以此类推:
f(xk)−f(x∗)≤2ηt1(∣∣xk−1−x∗∣∣2−∣∣xk−x∗∣∣2)
如果我们把上面的不等式左右两边分开累加到一起。
i=1∑kf(xk)−kf(x∗)≤2ηt1(∣∣xi−x∗∣∣2−∣∣xk−x∗∣∣2)
右边放大一点,去掉一个平方项:
i=1∑kf(xk)−kf(x∗)≤2ηt1∣∣xi−x∗∣∣2(4)
根据推论1的结论:
f(xi+1)≤f(xi)−2ηt∣∣▽f(xi)∣∣2
以及:
2ηt≥0和
∣∣▽f(xi)∣∣2≥0两个条件可知:
f(xi+1)≤f(xi)
因此我们可以写出:
f(xk)≤f(xk−1)≤f(xk−2)≤⋯≤f(x0)
根据这个,我们把(4)的左边进行缩小:
kf(xk)−kf(x∗)≤i=1∑kf(xk)−kf(x∗)
整理:
kf(xk)−kf(x∗)≤2ηt1∣∣xi−x∗∣∣2
.
f(xk)−f(x∗)≤2ηtk∣∣xi−x∗∣∣2
结束,上面这个式子就是补充说明里面梯度下降收敛的证明。