凸优化极简入门

在机器学习中,常常会涉及到凸优化相关内容,例如最大熵原理、SVM、神经网络的优化器。
本文对机器学习中涉及到的必须要掌握的凸优化相关内容做一个简单归纳。

一般优化问题

无约束优化问题

⾃变量为⽮量的函数 f f f: R n → R R^n \rightarrow R RnR
min ⁡ f ( x ) x ∈ R n \min f(\mathbf{x})\quad\mathbf{x}\in\mathbb{R}^n minf(x)xRn
局部最优解常规方法

  • 直接法
    • 梯度等于 0,求得驻点,必要时 Hessian 矩阵再进⼀步判断
  • 迭代法
    • 梯度下降法
    • 牛顿法
    • 拟牛顿法

⼀般约束优化问题案例

考虑以下约束优化问题
minimize f ( x ) = x 1 2 + x 2 2 − 4 x 1 + 4 = ( x 1 − 2 ) 2 + x 2 2 subject to c 1 ( x ) = x 1 − 2 x 2 + 6 ≥ 0 c 2 ( x ) = − x 1 2 + x 2 − 1 ≥ 0 ; c 3 ( x ) = x 1 ≥ 0 ; c 4 ( x ) = x 2 ≥ 0 \begin{aligned} \text{minimize}\quad&f(\mathbf{x})=x_1^2+x_2^2-4x_1+4=\left(x_1-2\right)^2+x_2^2 \\ \text{subject to}\quad&c_1(\mathbf{x})=x_1-2x_2+6\geq0 \\ &c_{2}\left(\mathbf{x}\right)=-x_{1}^{2}+x_{2}-1\geq0;c_{3}\left(\mathbf{x}\right)=x_{1}\geq0;c_{4}\left(\mathbf{x}\right)=x_{2}\geq0 \end{aligned} minimizesubject tof(x)=x12+x224x1+4=(x12)2+x22c1(x)=x12x2+60c2(x)=x12+x210;c3(x)=x10;c4(x)=x20
目标函数是圆的半径,不断向外扩,找到可行域内使得圆半径最小的值即为解。
image.png

行视图

矩阵乘法
[ 2 − 1 1 1 ] ⏟ A ∈ R 2 × 2 [ x y ] ⏟ x ∈ R 2 = [ 1 5 ] ⏟ b ∈ R 2 [ 2 1 1 4 − 6 0 − 2 7 2 ] ⏟ A ∈ R 3 × 3 [ u v w ] ⏟ x ∈ R 3 = [ 5 − 2 9 ] ⏟ b ∈ R 3 \begin{gathered}\underbrace{\left[\begin{array}{cc}2&-1\\1&1\end{array}\right]}_{\mathbf{A}\in\mathbb{R}^{2\times2}}\underbrace{\left[\begin{array}{c}x\\y\end{array}\right]}_{\mathbf{x}\in\mathbb{R}^{2}}=\underbrace{\left[\begin{array}{c}1\\5\end{array}\right]}_{\mathbf{b}\in\mathbb{R}^{2}}\\\underbrace{\left[\begin{array}{ccc}2&1&1\\4&-6&0\\-2&7&2\end{array}\right]}_{\mathbf{A}\in\mathbb{R}^{3\times3}}\underbrace{\left[\begin{array}{c}u\\v\\w\end{array}\right]}_{\mathbf{x}\in\mathbb{R}^{3}}=\underbrace{\left[\begin{array}{c}5\\-2\\9\end{array}\right]}_{\mathbf{b}\in\mathbb{R}^{3}}\end{gathered} AR2×2 [2111]xR2 [xy]=bR2 [15]AR3×3 242167102 xR3 uvw =bR3 529
行视图-超平面
2 x − y = 1 x + y = 5 \begin{aligned} 2x-y&=1\\ x+y&=5 \end{aligned} 2xyx+y=1=5
image.png

凸集/凸优化函数

为什么要凸优化

  • 思考:对于⽆约束优化问题,梯度等于 0 这⼀条件是否可以成为充要条件?
  • 思考:什么样的情况局部最⼩解可以成为全局最⼩解?
  • 思考:约束优化问题怎么办?
  • 思考:研究凸优化问题对于⾮凸问题⼜有什么帮助?

仿射集 (Affine Sets) 和凸集

仿射

⼀个集合 C ∈ R n C \in R^n CRn 是仿射的,则 C C C 中两点间的直线也在 C C C
例如 x = θ x 1 + ( 1 − θ ) x 2 ∈ C ; θ ∈ R x = \theta x_1+(1−\theta)x_2\in C; \theta \in R x=θx1+(1θ)x2C;θR,即 A x = b Ax = b Ax=b 的解

凸集

⼀个集合 C ∈ R n C \in R^n CRn 是凸的,则对于任意的 x ; y ∈ C x;y\in C x;yC,有 θ x 1 + ( 1 − θ ) x 2 ∈ C ; 0 ≤ θ ≤ 1 \theta x_1+(1−\theta)x_2\in C; 0 \le\theta\le1 θx1+(1θ)x2C;0θ1
image.png

注意:国内很多教材为了与汉字 “凸” 与 “凹” 相呼应,对于凹凸性与国外教材正好是相反的,这里Boyd编写的教材《Convex Optimization》为准。

常见的凸集

空间与平面
  • 所有 R n R^n Rn ,给定任意 x ; y ∈ R n x; y \in R^n x;yRn , 则有 θ x + ( 1 − θ ) y ∈ R n θx + (1 − θ)y \in R^n θx+(1θ)yRn
  • 所有 R + n R_+^n R+n
  • 超平⾯ (Hyperplane): 既是仿射⼜是凸
    C = { x ∣ a T x = b } C=\{\mathbf{x}\mid\mathbf{a}^T\mathbf{x}=b\} C={ xaTx=b}
  • 半空间 (Halfspace):只是凸
    image.png
范数球

范数回顾

  • 2-norm
    ∥ x ∥ 2 = ∑ i = 1 n ∣ x i ∣ 2 = ( x T x ) 1 / 2 \|\mathbf{x}\|_2=\sqrt{\sum_{i=1}^n|x_i|^2}=(\mathbf{x}^T\mathbf{x})^{1/2} x2=i=1nxi2 =(xTx)1/2
  • 1-norm:
    ∥ x ∥ 1 = ∑ i = 1 n ∣ x i ∣ \|\mathbf{x}\|_1=\sum_{i=1}^n|x_i| x1=i=1nxi
  • ∞-norm
    ∥ x ∥ ∞ = max ⁡ i = 1 , . . . , n ∣ x i ∣ \|\mathbf{x}\|_\infty= \max_{i=1,...,n}|x_i| x=i=1,...,nmaxxi
  • p-norm, p ≥ 1:
    ∥ x ∥ p = ∑ i = 1 n ∣ x i ∣ p p \|\mathbf{x}\|_p=\sqrt[p]{\sum_{i=1}^n|x_i|^p} xp=pi=1nxip
    范数球也是凸集
    范数球,例1如 ∣ ∣ x ∣ ∣ 2 ≤ 1 ||x||_2 ≤ 1 ∣∣x21. 给定任意 x ; y ∈ R n 且 ∣ ∣ x ∣ ∣ —— 2 ≤ 1 , ∣ ∣ y ∣ ∣ —— 2 ≤ 1 x; y \in R_n 且 || x ||——2 ≤ 1 , ||y||——2 ≤ 1 x;yRn∣∣x∣∣——21∣∣y∣∣——21 ,则有
    ∣ ∣ θ x + ( 1 − θ ) y ∣ ∣ 2 ≤ θ ∣ ∣ x ∣ ∣ 2 + ( 1 − θ ) ∣ ∣ y ∣ ∣ 2 ≤ 1 ||θx + (1 − θ) y||_2 ≤ θ|| x ||_2 + (1 − θ) ||y||_2 ≤ 1 ∣∣θx+(1θ)y2θ∣∣x2+(1θ)∣∣y21
    image.png
多面体

多⾯体 (Polyhedron): 有限个半空间和半平⾯的交集
P = { x ∣ A x ≤ b ; C x = d } , 其中 A ∈ R m × n , b ∈ R m , C ∈ R p × n , d ∈ R p \begin{aligned}\mathbf{P}=\{\mathbf{x}\mid\mathbf{A}\mathbf{x}\leq\mathbf{b};\mathbf{C}\mathbf{x}=\mathbf{d}\},\text{其中 A}\in\mathbb{R}^{m\times n},\mathbf{b}\in\mathbb{R}^m,\mathbf{C}\in\mathbb{R}_{p\times n},\mathbf{d}\in\mathbb{R}_p\end{aligned} P={ xAxb;Cx=d},其中 ARm×n,bRm,CRp×n,dRp

凸集的性质

凸集的交集是凸集
例如: S = ∥ x ∥ ≤ 1 ; x ≥ 0 S = {∥x ∥ ≤ 1; x \ge 0} S=x1;x0
证明:假定 S 1 ; ⋯   ; S k S_1;\cdots;S_k S1;;Sk是凸集,给定\ x ; y ∈ ∩ i = 1 k S i \mathbf{x};\mathbf{y}\in\cap_{i=1}^kS_i x;yi=1kSi,则有
θ x + ( 1 − θ ) y ∈ S i ; i = 1 ; ⋯   ; k \theta\mathbf{x}+(1-\theta)\mathbf{y}\in S_i;\quad i=1;\cdots;k θx+(1θ)ySi;i=1;;k
因此,
θ x   +   ( 1   −   θ ) y   ∈ ∩ i = 1 k S i \theta\mathbf{x}\:+\:(1\:-\:\theta)\mathbf{y}\:\in\cap_{i=1}^kS_i θx+(1θ)yi=1kSi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值