§ 1. Optimization Problem¶
Definition of Optimization Problem¶
Definition 1.1 : Optimization Problem
In an optimization problem, we minimize or maximize a function value, possibly subject to constraints.
- Decision variable: \(\theta\)
- Objective function: \(f\)
- Equality constraint: \(h_{i}(\theta)=0\) for \(i=1, \ldots, m\)
- Inequality constraint: \(g_{j}(\theta) \leq 0\) for \(j=1, \ldots, n\)
In machine learning (ML), we often minimize a "loss", but sometimes we maximize the "likelihood". In any case, minimization and maximization are equivalent since
Definition 1.2 : Feasible Point and Constraints
\(\theta \in \mathbb{R}^{p}\) is a feasible point if it satisfies all constraints:
Optimization problem is infeasible if there is no feasible point.
An optimization problem with no constraint is called an unconstrained optimization problem. Optimization problems with constraints is called a constrained optimization problem.
Definition 1.3 : Optimal Value and Solution
Optimal value of an optimization problem is
- \(p^{\star}=\infty\) if problem is infeasible
- \(p^{\star}=-\infty\) is possible
- In ML, it is often a priori clear that \(0 \leq p^{\star}<\infty\).
If \(f\left(\theta^{\star}\right)=p^{\star}\), we say \(\theta^{\star}\) is a solution or \(\theta^{\star}\) is optimal.
A solution may or may not exist, and a solution may or may not be unique.
Examples of Optimization Problem¶
Consider setup with data \(X_{1}, \ldots, X_{N}\) and corresponding labels \(Y_{1}, \ldots, Y_{N}\) satisfying the relationship
for \(i=1, \ldots, N\). Hopefully, "error" is small. True function \(f_{\star}\) is unknown.
Goal is to find a function (curve) \(f\) such that \(f \approx f_{\star}\).
Example 1.5 : Least-Squares Minimization
-
Problem
\[ \underset{\theta \in \mathbb{R}^{p}}{\operatorname{minimize}} \quad \frac{1}{2}\|X \theta-Y\|^{2} \]where \(X \in \mathbb{R}^{N \times p}\) and \(Y \in \mathbb{R}^{N}\). Equivalent to
\[ \underset{\theta \in \mathbb{R}^{p}}{\operatorname{minimize}} \frac{1}{2} \sum_{i=1}^{N}\left(X_{i}^{\top} \theta-Y_{i}\right)^{2} \]where \(X=\left[\begin{array}{c}X_{1}^{\top} \\ \vdots \\ X_{N}^{\top}\end{array}\right]\) and \(Y=\left[\begin{array}{c}Y_{1} \\ \vdots \\ Y_{N}\end{array}\right]\).
-
Solution
To solve
\[ \underset{\theta \in \mathbb{R}^{p}}{\operatorname{minimize}} \frac{1}{2}\|X \theta-Y\|^{2} \]take gradient and set it to \(0\).
\[ \nabla_{\theta} \frac{1}{2}\|X \theta-Y\|^{2}=X^{\top}(X \theta-Y) \]\[ \begin{gathered} X^{\top}\left(X \theta^{\star}-Y\right)=0 \\ \theta^{\star}=\left(X^{\top} X\right)^{-1} X^{\top} Y \end{gathered} \]Here, we assume \(X^{\top} X\) is invertible.
Concept 1.6 : Least squares is an instance of curve fitting.
Define \(f_{\theta}(x)=x^{\top} \theta\). Then LS becomes
and the solution hopefully satisfies
Since \(X_{i}\) and \(Y_{i}\) is assumed to satisfy
we are searching over linear functions (linear curves) \(f_{\theta}\) that best fit (approximate) \(f_{\star}\).
Local and Global Minimum¶
Definition 1.7 : Local vs Global Minima
\(\theta^{\star}\) is a local minimum if \(f(\theta) \geq f\left(\theta^{\star}\right)\) for all feasible \(\theta\) within a small neighborhood.
\(\theta^{\star}\) is a global minimum if \(f(\theta) \geq f\left(\theta^{\star}\right)\) for all feasible \(\theta\).

In the worst case, finding the global minimum of an optimization problem is difficult. However, in deep learning, optimization problems are often "solved" without any guarantee of global optimality.