-
optimization: find solution to minimize a certain function
- \thetaθ: variables / parameters of problem to learn (e.g. \theta = \mathbf wθ=w in logistic regression)
- \mathcal XX: domain of \thetaθ (e.g. set of real numbers)
- f(\theta)f(θ): objective function (e.g. negative log likelihood)
- goal: find \theta^* = \argmin_{\theta \in \mathcal X} f(\theta)θ∗=argminθ∈Xf(θ) (global minimum of function ff; alternatively, maximum for some other problems)
-
convex set: XX convex \iff⟺ \forall x,y \in X, \lambda \in [0,1]: \lambda x+(1-\lambda)y \in X∀x,y∈X,λ∈[0,1]:λx+(1−λ)y∈X
- in other words: a set XX is convex if the line segment between any two points in XX lies in XX

-
convex function: f(\mathbf x)f(x) convex function on the convex set XX \iff⟺ \forall \mathbf{x,y} \in X, \lambda \in [0,1]:\lambda f(\mathbf x) + (1-\lambda)f(\mathbf y) \geq f(\lambda \mathbf x + (1-\lambda)\mathbf y)∀x,y∈X,λ∈[0,1]:λf(x)+(1−λ)f(y)≥f(λx+(1−λ)y)
- in other words: a real-valued function ff is called convex if the line segment between any two distinct points on the graph of the function lies above or on the graph of the function between the two points

- (!) region above a convex function is convex
- (!) every local minimum is a global minimum (zero gradient \implies⟹ minimum for convex functions)
- f_0f0 convex, \nabla f_0(\theta^*)=0 \implies \theta∇f0(θ∗)=0⟹θ is a global minimum
- first order convexity theorem: let f:X\to\Rf:X→R be a differentiable function, and XX convex; then ff is convex iff \forall \mathbf{x,y}\in X: f(\mathbf y) \geq f(\mathbf x) + (\mathbf y - \mathbf x)^T\nabla f(\mathbf x)∀x,y∈X:f(y)≥f(x)+(y−x)T∇f(x)
- verifying convexity of a function: proving definition (tedious), exploiting special results, showing that the function can be obtained from convex functions by operations that preserve convexity
- special results: first order convexity theorem (e.g. a twice differentiable function of one variable is convex on an interval iff its second derivative is non-negative on this interval; more generally, a twice differentiable function of several variables is convex on a convex set if and only if its Hessian matrix is positive semidefinite on the set)
- through convexity preserving operations: start with simple convex functions, then apply construction rules
- convex functions
- f(x)=cf(x)=c
- f(x)=ax+bf(x)=ax+b
- f(x)=x²f(x)=x2
- f(x)=e^xf(x)=ex
- f(x_1,...,x_n)=\log(\sum_ie^{x_i})f(x1,...,xn)=log(∑iexi)
- f(x)=||x||f(x)=∣∣x∣∣
- f(x)=|x|f(x)=∣x∣
- f(x)=x^pf(x)=xp for p\geq 1, x \geq 0p≥1,x≥0 and p \leq 0, x > 0p≤0,x>0
- f(x)=-\log xf(x)=−logx for x>0x>0
- concave functions
- f(x)=cf(x)=c
- f(x)=ax+bf(x)=ax+b
- f(x)=-x²f(x)=−x2
- f(x)=x^pf(x)=xp for 0 < p \leq 1, x \geq 00<p≤1,x≥0
- f(x)=-x\log xf(x)=−xlogx for x>0x>0
- construction rules: let f_1:\R^d\to\R, f_2:\R^d\to\Rf1:Rd→R,f2:Rd→R be convex functions, and g:\R^d\to\Rg:Rd→R be concave, then the following are convex...
- h(\mathbf x)=f_1(\mathbf x)+f_2(\mathbf x)h(x)=f1(x)+f2(x)
- h(\mathbf x)=\max\{f_1(\mathbf x),f_2(\mathbf x)\}h(x)=max{f1(x),f2(x)}
- h(\mathbf x)=c\cdot f_1(\mathbf x)h(x)=c⋅f1(x) if c \geq 0c≥0
- h(\mathbf x)=c\cdot g(\mathbf x)h(x)=c⋅g(x) if c \leq 0c≤0
- h(\mathbf x)=f_1(\mathbf{Ax+b})h(x)=f1(Ax+b)
- h(\mathbf x)=m(f_1(\mathbf x))h(x)=m(f1(x)) if m:\R\to\Rm:R→R covex and non-decreasing
- verifying convexity of sets: prove definition (often easier than for functions), apply intersection rule
- intersection rule: if A,BA,B are convex sets, then A \cap BA∩B is a convex set
-
first-order optimization techniques: only exploit information of the gradients (i.e. first order derivative)
-
gradient descent: take repeated steps in the opposite direction of the gradient (or approximate gradient) of the function at the current point, because this is the direction of steepest descent; stepping in the direction of the gradient will lead to a trajectory that maximizes that function
- given starting point \theta \in \text{Dom}(f)θ∈Dom(f), repeat until stopping criterion satisfied...
- \Delta \theta:=-\nabla f(\theta)Δθ:=−∇f(θ)
- choose t^* = \argmin_{t>0}f(\theta+t\cdot\Delta\theta)t∗=argmint>0f(θ+t⋅Δθ)
- update \theta := \theta + t^*\Delta\thetaθ:=θ+t∗Δθ
- convergence: strongly convex ⇒ linear (geometric) convergence in function value; iteration bounds scale logarithmically with target precision

- faster: avoid line search (2), simply pick update \theta_{t+1} \leftarrow \theta_t - \tau \nabla f(\theta_t)θt+1←θt−τ∇f(θt)
- \tauτ: learning rate (too small \to→ slow convergence, might end up in local minima or saddle points; too high \to→ algorithm might oscillate, so no convergence)

- learning rate adaptation / schedule: let the learning rate be a decreasing function τ_tτt of the iteration number tt (first iterations cause large changes in the parameters; later do fine-tuning); convergence guaranteed if \lim_{t\to\infty}\tau_t = 0limt→∞τt=0
- example: \tau_{t+1} \leftarrow \alpha \cdot \tau_tτt+1←α⋅τt for 0 < \alpha < 10<α<1
- alternatives: incorporate history of previous gradients
- momentum: \mathbf m_t \to \tau \nabla f(\theta_t) + \gamma \mathbf m_{t-1};\;\;\;\theta_{t+1} \leftarrow \theta_t - \mathbf m_tmt→τ∇f(θt)+γmt−1;θt+1←θt−mt (often \gamma=0.5γ=0.5, as long as gradients point to the same direction, the search accelerates)
-
Newton method: higher order, fast local convergence, fewer passes through data, but O(d²)O(d2) compute and O(d³)O(d3) update
-
stochastic gradient descent (SGD): replace full gradient by unbiased mini-batch estimate; update using sampled subset; much cheaper per update, higher variance; typical epoch = one pass through all data; for convex problems SGD converges almost surely