2.1 Introduction to Optimization
Cost functions, local versus global minima, convexity, and first- and second-order tests.
These notes walk through the lecture slides. The original deck is unchanged; use (slides) on the course hub if you want that PDF.
The figures follow Deisenroth, Faisal, and Ong, Mathematics for Machine Learning.
1. Training is optimization
Training a model is finding a good . Good is whatever the cost (objective) says it is.

Write and solve
Usually . This course always minimizes. Maximizing profit is minimizing .
2. Linear regression
Model . Fit by minimizing mean squared error on training rows:
Each step that lowers shrinks residuals. Better on the training set is the hope that predictions on new improve too. That hope is generalization; the math this week is the min.
3. Local versus global
A local minimum is lowest in a neighborhood: some such that implies . A global minimum is lowest on all of .
A valley on a hike is local. The lowest point in the whole range is global. Neural-net costs look like the landscape below. Many valleys. The one you land in need not be the lowest.

If is convex,
for all and all , then every local min is global.

| Convex (this course) | Not convex |
|---|---|
| Linear regression (MSE) | Deep nets |
| Logistic regression (log loss) | -means |
| Soft-margin SVM | GMM likelihood |
Convex: gradient descent that reaches a local min has the global min. Nonconvex: you can stop in a valley that is not the bottom.
4. First- and second-order tests
First-order (necessary). At a local min of a smooth unconstrained , . The slope is flat.
Second-order (sufficient). If that point also has Hessian positive definite, it is a local min.
A zero gradient is not enough: a saddle is flat and is not a min. Week 2’s algorithms either follow or invert .
5. Practice
-
When does a local minimum fail to be global?
-
Why does this course write every learning problem as a min, even when the story is “maximize likelihood”?
-
At a point with , what extra fact about lets you call it a local min rather than a saddle?