Which shape gives us the clearest route to a global minimum?
A. The jumpy loss.
B. The smooth loss with several minima.
C. The smooth bowl.
C. The smooth bowl gives useful downhill directions without competing valleys.
This suggests a “nice” objective shape. We will call it convex and define it precisely next.
The definition of convexity will formalize this shape for one or many parameters.
A set \(\mathcal D\subseteq\mathbb R^d\) is convex if \[\forall\boldsymbol u,\boldsymbol v\in\mathcal D,\quad\forall t\in[0,1],\quad (1-t)\boldsymbol u+t\boldsymbol v\in\mathcal D.\]
Visual segment test: the entire segment must stay inside the domain for every pair.
\(J\) is convex on a convex domain if, for every \(\boldsymbol{u},\boldsymbol{v}\) in the domain and \(0\le t\le1\),
\[{\color{#27847f}{J\big(}}{\color{#b8872f}{(1-t)}}{\color{#2f6b8a}{\boldsymbol{u}}}+{\color{#b8872f}{t}}{\color{#756486}{\boldsymbol{v}}}{\color{#27847f}{\big)}} \le {\color{#b8872f}{(1-t)}}{\color{#2f6b8a}{J(\boldsymbol{u})}}+{\color{#b8872f}{t}}{\color{#756486}{J(\boldsymbol{v})}}.\]
Loss at the averaged input ≤ average of the endpoint losses.
Proof by contradiction. Let \(J\) be convex on a convex domain \(\mathcal D\).
Local minimality at \(\boldsymbol u\) means: for some \(r>0\), \[J(\boldsymbol x)\ge J(\boldsymbol u)\quad\text{whenever }\boldsymbol x\in\mathcal D,\ \|\boldsymbol x-\boldsymbol u\|<r.\]
Suppose \(\boldsymbol u\) is not global: some \(\boldsymbol v\in\mathcal D\) has \(J(\boldsymbol v)<J(\boldsymbol u)\).
Choose \(0<t<\min\{1,r/\|\boldsymbol v-\boldsymbol u\|\}\) and set \(\boldsymbol x_t=(1-t)\boldsymbol u+t\boldsymbol v\).
The segment stays in \(\mathcal D\), and \(\|\boldsymbol x_t-\boldsymbol u\|=t\|\boldsymbol v-\boldsymbol u\|<r\).
\[J(\boldsymbol x_t)\le(1-t)J(\boldsymbol u)+tJ(\boldsymbol v)\quad\text{(convexity)}\]
\[\phantom{J(\boldsymbol x_t)}< (1-t)J(\boldsymbol u)+tJ(\boldsymbol u)=J(\boldsymbol u)\quad\text{(strictly lower loss, }t>0\text{)}.\]
Contradiction: a lower value lies inside the local-minimum neighborhood. Thus \(\boldsymbol u\) is global.
Let \(J\) be twice continuously differentiable on an open convex domain.
| Parameters | Equivalent criterion for convexity |
|---|---|
| One scalar \(\theta\) | \(J''(\theta)\ge0\) everywhere |
| A vector \(\boldsymbol{\theta}\) | \(H(\boldsymbol{\theta})=\nabla^2J(\boldsymbol{\theta})\succeq0\) everywhere |
The Hessian is the matrix of second partial derivatives: \(H_{jk}=\frac{\partial^2J}{\partial\theta_j\partial\theta_k}\).
Positive semidefinite (PSD) means \(\boldsymbol{v}^{\mathsf T}H\boldsymbol{v}\ge0\) for every direction \(\boldsymbol{v}\). Equivalently, all eigenvalues of \(H\) are \(\ge0\): no eigenvector direction curves downward; zero allows a flat direction at that point.
Near any point \(\theta_0\), with \(h=\theta-\theta_0\), \[J(\theta_0+h)=\underbrace{J(\theta_0)+J'(\theta_0)h+\tfrac12J''(\theta_0)h^2}_{\text{local quadratic approximation}}+o(h^2).\]
Append the intercept to \(\widetilde X\) and the coefficients to \(\boldsymbol{\theta}\).
| Objective | Hessian \(H=\nabla^2J\) |
|---|---|
| OLS | \(\frac1n\widetilde X^{\mathsf T}\widetilde X\) |
| Logistic log loss | \(\frac1n\widetilde X^{\mathsf T}W\widetilde X\), with \(W_{ii}=a_i(1-a_i)\ge0\) |
For logistic loss, \(\ell(z,y)=\log(1+e^z)-yz\) gives \(\ell'=\sigma(z)-y\) and \(\ell''=a(1-a)\).
\[\boldsymbol{v}^{\mathsf T}H\boldsymbol{v} =\frac1n\sum_i a_i(1-a_i)(\widetilde{\boldsymbol{x}}_i^{\mathsf T}\boldsymbol{v})^2\ge0.\]
For OLS, replace the weights by 1. Both objectives are convex in the coefficients.
Next: a useful shape does not itself tell us how to compute the solution.