最近在看"Machine Learning A Probability Perspective"的逻辑回归,因为涉及些优化的算法,一起看书的伙伴们就决定把"Convex Optimization"优化的内容看一下。
在阅读以下内容之前,要记住问题的出发点,即给定无约束的凸问题该用什么方法求得最优解(这里假设问题是求最小值)?各种方法之间有什么性质。
也许最先想到的方法就是对变量求梯度,让它等于000的变量值就是最优解。没错,这样的方法很简单,但是当求导过程过于复杂的时候该怎么办呢?也许你还知道梯度下降,牛顿法等等。如果你对这些方法没有听说过,或者还想知道更多,那接着阅读下去吧,当然最好还是建议你看一下原书。
最近正在忙毕设(好慌,QAQ!),看的内容比较少,这次内容包括:
- 强凸及其性质
- 下降方法求解的框架
- 梯度下降算法收敛性分析
- 最速下降法
- 牛顿方法
强凸及其性质
函数强凸是说在凸集S\rm{S}S中,对于∀x∈S\forall \mathbf{x}\in \rm S∀x∈S均有下式成立:
∇2f(x)≽m I
\nabla^2 f(\mathbf{x}) \succcurlyeq m \, \mathbf I
∇2f(x)≽mI
其中m>0m>0m>0,将上式带入到函数的泰勒展开式
f(y)=f(x)+∇f(x)T(y−x)+12(y−x)T∇2f(x)(y−x)
f(\mathbf y)=f(\mathbf{x})+\nabla f(\mathbf x)^T(\mathbf y-\mathbf x)+\frac{1}{2}(\mathbf y-\mathbf x)^T\nabla^2f(\mathbf x)(\mathbf y-\mathbf x)
f(y)=f(x)+∇f(x)T(y−x)+21(y−x)T∇2f(x)(y−x)
得到
(1)f(y)≥f(x)+∇f(x)T(y−x)+m2∥y−x∥22
f(\mathbf y)\geq f(\mathbf x)+\nabla f(\mathbf x)^T(\mathbf y-\mathbf x)+\frac{m}{2}\Vert\mathbf y-\mathbf x\Vert_2^2 \tag 1 f(y)≥f(x)+∇f(x)T(y−x)+2m∥y−x∥22(1)
在等式右边对y\mathbf yy求梯度,得到:
y−x=−1m∇f(x)
\mathbf y - \mathbf x=-\frac{1}{m}\nabla f(\mathbf x)
y−x=−m1∇f(x)
带入得到
(2)f(y)≥f(x)−12m∥∇f(x)∥22
f(\mathbf y)\geq f(\mathbf x)-\frac{1}{2m}\Vert\nabla f(\mathbf x)\Vert^2_2 \tag{2}
f(y)≥f(x)−2m1∥∇f(x)∥22(2)
令y=x∗\mathbf y=\mathbf x^*y=x∗,可以得到∇f(x)\nabla f(\mathbf x)∇f(x)的下界
∥∇f(x)∥22≥2m(f(x)−p∗)
\Vert \nabla f(\mathbf x)\Vert_2^2\geq 2m(f(\mathbf x)-p^*)
∥∇f(x)∥22≥2m(f(x)−p∗)
可以看到,当某一点的梯度越小时,其越接近最优点,而这与最优点梯度为0的常识相符合。因此也可以用∥∇f(x)∥22≤ϵ\Vert \nabla f(\mathbf x)\Vert_2^2\leq\epsilon∥∇f(x)∥22≤ϵ当作收敛条件。
将x∗\mathbf x^*x∗带入到(1)中,再利用柯西施瓦茨不等式得到:
f(x∗)≥f(x)−∥∇f(x)∥2∥x∗−x∥2+m2∥x∗−x∥22
f(\mathbf x^*)\geq f(\mathbf x)-\Vert \nabla f(\mathbf x) \Vert_2\Vert\mathbf x^*-\mathbf x \Vert_2+\frac{m}{2}\Vert\mathbf x^* - \mathbf x\Vert_2^2
f(x∗)≥f(x)−∥∇f(x)∥2∥x∗−x∥2+2m∥x∗−x∥22
可以得到
∥x−x∗∥2≤2m∥∇f(x)∥2
\Vert \mathbf x - \mathbf x^*\Vert_2 \leq \frac{2}{m}\Vert \nabla f(\mathbf x)\Vert_2
∥x−x∗∥2≤m2∥∇f(x)∥2
即通过∥∇f(x)∥2\Vert \nabla f(\mathbf x)\Vert_2∥∇f(x)∥2可以得到x\mathbf xx和x∗\mathbf x^*x∗的差距上界。
一般而言S\rm SS被当做是下子集,是有界的,故存在M>0M>0M>0使得∀x∈S\forall \mathbf x\in \rm S∀x∈S满足
∇2f(x)⪯MI
\nabla^2f(\mathbf x)\preceq M\mathbf I
∇2f(x)⪯MI
使用相同的方法,可以得到:
f(y)⪯f(x)+∇f(x)T(y−x)+M2∥y−x∥22p∗⪯f(x)−12M∥∇f(x)∥22
f(\mathbf y)\preceq f(x)+\nabla f(\mathbf x)^T(\mathbf y-\mathbf x)+\frac{M}{2}\Vert\mathbf y- \mathbf x \Vert_2^2\\
p^* \preceq f(\mathbf x)-\frac{1}{2M}\Vert \nabla f(\mathbf x)\Vert_2^2
f(y)⪯f(x)+∇f(x)T(y−x)+2M∥y−x∥22p∗⪯f(x)−2M1∥∇f(x)∥22
定义κ=Mm\kappa = \frac{M}{m}κ=mM为S\rm SS的condition number\textit condition \, numberconditionnumber,condition number\textit condition \, numberconditionnumber会在之后的收敛性分析中扮演重要的角色。∇2f(x)\nabla^2 f(\mathbf x)∇2f(x)是实对称矩阵,可以看出condition number\textit condition\, numberconditionnumber可以看作∇2f(x)\nabla^2f(\mathbf x)∇2f(x)在∀x∈S\forall \mathbf x \in \rm S∀x∈S中最大特征值和最小特征值的比值。关于条件数和几何解释的衔接还在考虑怎么写
下面对condition number\textit condition \, numberconditionnumber进行几何解释,设凸集合CCC的沿某一方向上的宽度为
W(C,q)=supz∈CqTz−infz∈CqTz
W(C,q)=\sup_{z\in C}q^Tz-\inf_{z\in C}q^Tz
W(C,q)=z∈CsupqTz−z∈CinfqTz
集合CCC在不同方向上的最大最小宽度如下:
Wmin=inf∣q∣2=1W(C,q)Wmax=sup∣q∣2=1W(C,q)
W_{\min}=\inf_{\vert q\vert_2=1}W(C,q)\\
W_{\max}=\sup_{\vert q\vert_2=1}W(C,q)
Wmin=∣q∣2=1infW(C,q)Wmax=∣q∣2=1supW(C,q)
而condition numbercondition\, numberconditionnumber为Wmax2/Wmin2W_{max}^2/W_{min}^2Wmax2/Wmin2,从而可以看出condition numbercondition\, numberconditionnumber越小说明集合CCC越圆,反之则其各项异性比较大。
对于α\alphaα-sublevel子集Cα={x∣f(x)≤α}C_{\alpha}=\{\mathbf x\vert f(\mathbf x)\leq\alpha\}Cα={x∣f(x)≤α},根据(2)和类似的式子可得
p∗+M2∥x∗−y∥22≥f(y)≥p∗+m2∥x∗−y∥22
p^*+\frac{M}{2}\Vert\mathbf x^*-\mathbf y \Vert_2^2\geq f(\mathbf y)\geq p^*+\frac{m}{2}\Vert\mathbf x^*-\mathbf y \Vert_2^2
p∗+2M∥x∗−y∥22≥f(y)≥p∗+2m∥x∗−y∥22
再利用α≥f(y)\alpha \geq f(\mathbf y)α≥f(y),则α≥p∗+m2∥x∗−y∥22\alpha \geq p^*+\frac{m}{2}\Vert\mathbf x^*-\mathbf y \Vert_2^2α≥p∗+2m∥x∗−y∥22。当y\mathbf yy趋近于x∗\mathbf x^*x∗时,p∗+M2∥x∗−y∥22p^*+\frac{M}{2}\Vert\mathbf x^*-\mathbf y \Vert_2^2p∗+2M∥x∗−y∥22趋近于p∗p^*p∗,此时α≥p∗+M2∥x∗−y∥22\alpha \geq p^*+\frac{M}{2}\Vert\mathbf x^*-\mathbf y \Vert_2^2α≥p∗+2M∥x∗−y∥22可以求得部分y\mathbf yy的范围。上述两个不等式可以得到:
Binner={y∣∥y−x∗∥22≤2M(α−p∗)}Bouter={y∣∥y−x∗∥22≤2m(α−p∗)}
B_{inner}=\{\mathbf y\vert \Vert \mathbf y-\mathbf x^* \Vert_2^2\leq \frac{2}{M}(\alpha-p^*)\}\\
B_{outer}=\{\mathbf y\vert \Vert \mathbf y-\mathbf x^* \Vert_2^2\leq \frac{2}{m}(\alpha-p^*)\}
Binner={y∣∥y−x∗∥22≤M2(α−p∗)}Bouter={y∣∥y−x∗∥22≤m2(α−p∗)}
可见α\alphaα下子集在BinnerB_{inner}Binner和BouterB_{outer}Bouter之间,则根据几何解释cond(Cα)≤Mm\textbf{cond}(C_{\alpha})\leq \frac{M}{m}cond(Cα)≤mM。这样,condition numbercondition \, numberconditionnumber和下子集的形状联系了起来。
当α\alphaα趋近于x∗\mathbf x^*x∗时,根据泰勒展开,其梯度可以认为是0,得到下子集CαC_\alphaCα
Cα={y∣(y−x∗)T∇2f(x)(y−x∗)≤2(α−p∗)}
C_\alpha = \{\mathbf y|(\mathbf y - \mathbf x^*)^T\nabla^2f(\mathbf x)(\mathbf y - \mathbf x^*)\leq 2(\alpha - p^*)\}
Cα={y∣(y−x∗)T∇2f(x)(y−x∗)≤2(α−p∗)}
可以看到此时的下子集CαC_\alphaCα接近为∇2f(x∗)\nabla^2 f(\mathbf x^*)∇2f(x∗)的椭球,此时的cond(Cα)=κ∇2f(x∗)\textbf{cond}(C_{\alpha})=\kappa{\nabla^2 f(\mathbf x^*)}cond(Cα)=κ∇2f(x∗)。