Seyed Masoud Hosseini · Overview · Study log · Weekly summaries · Ideas · Search · Transcript · RSS feed

Matrix Methods for Data Analysis & ML · Lecture 23 of 36 · 53:44

Lecture 21: Minimizing a Function Step by Step

Lecture 21: Minimizing a Function Step by Step on YouTube

Study guide

What this lecture covers

This lecture opens the course's optimization unit, the algorithmic foundation for deep learning. It develops the multivariable Taylor series through the gradient and Hessian, sets up Newton's method for solving systems of equations and for minimizing functions, and works a scalar example to show Newton's method converges quadratically. The second half introduces convexity, first for sets and then for functions, as the property that makes optimization problems well behaved.

This is the first of two lectures on optimization before the course moves to gradient descent specifically. After watching, you should be able to write the gradient and Hessian of a multivariable function, explain why Newton's method converges quickly but is expensive for large problems, and test whether a set or function is convex.

Key ideas

  • Gradient and Hessian: for a function of n variables, the gradient is the vector of first partial derivatives and the Hessian H is the symmetric matrix of second partial derivatives; both appear in the three-term Taylor series f(x + Delta x) ~ f(x) + gradient^T Delta x + 1/2 Delta x^T H Delta x.
  • Jacobian: for a vector-valued function F of n variables, the Jacobian is the matrix of first derivatives J_jk = dF_j/dx_k, generalizing the gradient to systems of equations.
  • Newton's method for equations: iterates x_{k+1} = x_k - J^{-1} F(x_k), and for the scalar example f(x) = x^2 - 9, the error satisfies error_{k+1} = error_k^2 / (2 x_k), showing quadratic convergence near a root.
  • Newton's method for minimization: uses the Hessian instead of the Jacobian, x_{k+1} = x_k - H^{-1} gradient(x_k), converging quadratically but requiring O(n^2) second-derivative entries per step.
  • Steepest descent: moves in the direction of -gradient(f) with a chosen step size (learning rate); an exact line search picks the step that minimizes f along that direction, though in practice a fixed or backtracking step size is often used instead.
  • Convex sets: a set is convex if the line segment between any two points in the set stays in the set; intersections of convex sets are always convex, but unions generally are not.
  • Convex functions: a function is convex if the region on and above its graph (the epigraph) is a convex set; for a scalar function this matches the second-derivative test, and in n variables it corresponds to a positive semidefinite (or definite, for strict convexity) Hessian.

Walkthrough

The multivariable Taylor series (1:06)

Strang extends the familiar Taylor series to n variables, introducing the gradient as the vector of first derivatives and the Hessian as the symmetric matrix of second derivatives, noting that computing the full Hessian costs roughly n^2/2 entries, which becomes expensive for the very large problems deep learning involves.

Newton's method for systems of equations (10:31)

For solving F(x) = 0, Strang derives Newton's iteration using the Jacobian, then works the scalar example f(x) = x^2 - 9, showing algebraically that the error at each step is the square of the previous error divided by 2x_k - the source of Newton's method's fast, quadratic convergence near a solution.

Newton's method for optimization (22:48)

The same reasoning is applied to minimizing a function, replacing the Jacobian with the Hessian: x_{k+1} = x_k - H^{-1} gradient(x_k). Strang contrasts this with steepest descent, which uses only the gradient direction and a chosen step size, giving linear rather than quadratic convergence but avoiding the cost of computing the Hessian.

Convex sets (32:07)

Convexity is introduced as the key property for well-behaved optimization problems. A convex set is one where the segment between any two of its points stays inside it; Strang checks this with triangle examples, showing intersections of convex sets are always convex while unions generally are not.

Convex functions (44:29)

A function is defined as convex when the region on and above its graph is a convex set. Strang shows that the minimum of two convex functions is generally not convex (it has a kink), while the maximum of any collection of convex functions is convex. The lecture closes by connecting convexity to the Hessian: positive semidefinite for convexity, positive definite for strict convexity, matching the ordinary second-derivative test in one variable.

Before you watch

  • Review the SVD and symmetric matrix material from earlier in the course, since positive definiteness is used throughout.
  • Familiarity with single-variable Taylor series and derivatives (basic calculus) is assumed.

Check your understanding

  1. Why does Newton's method converge quadratically, while steepest descent typically converges only linearly?
  2. What makes computing the full Hessian expensive for large-scale problems like deep learning?
  3. Why is the intersection of two convex sets always convex, while the union usually is not?
  4. How does the Hessian test for convexity in several variables generalize the second-derivative test from one variable?

Vocabulary

multivariable (adjective)
Involving more than one variable at once.
The multivariable Taylor series uses several inputs.
Taylor series (noun)
A way of approximating a function using its value and derivatives at one point.
The Taylor series gives a local approximation of f near x.
gradient (noun)
The vector of a function's first partial derivatives, pointing toward the steepest increase.
The gradient shows the direction of fastest increase.
Hessian (noun)
The matrix of a function's second partial derivatives.
The Hessian tells you about the function's curvature.
partial derivative (noun)
The rate of change of a function with respect to just one variable, holding the others fixed.
The gradient's entries are the function's partial derivatives.
Jacobian (noun)
A matrix of first derivatives for a function that outputs several values.
The Jacobian generalizes the gradient to vector-valued functions.
Newton's method (noun)
An iterative technique that uses derivatives to quickly find a root or minimum.
Newton's method converges very fast near the answer.
iterate (verb)
To repeat a step again and again to refine an answer.
Newton's method iterates using the Jacobian.
quadratic convergence (noun)
A very fast rate of approaching the correct answer, where the error shrinks by squaring.
Newton's method shows quadratic convergence near a root.
steepest descent (noun)
An optimization method that moves in the direction of the negative gradient.
Steepest descent uses only the gradient, not the Hessian.
line search (noun)
A method for choosing the best step size along a fixed direction.
An exact line search minimizes f along the descent direction.
backtracking (noun)
A method that starts with a large step and shrinks it until progress is good enough.
Backtracking halves the step size repeatedly.
convex set (noun)
A set where the line between any two of its points stays inside the set.
A triangle's interior is a convex set.
convex function (noun)
A function whose graph curves upward, with a bowl-like shape.
A convex function has a positive semidefinite Hessian.
epigraph (noun)
The region on and above a function's graph.
A function is convex when its epigraph is a convex set.
kink (noun)
A sharp bend or corner in a curve.
The minimum of two convex functions can have a kink.
algorithmic (adjective)
Relating to a step-by-step computational procedure.
Optimization is the algorithmic foundation for deep learning.
root (noun)
A value where a function equals zero.
Newton method finds the root of an equation.
well behaved (adjective)
Having predictable, nice properties that make analysis easier.
Convex problems are well behaved for optimization.
triangle (noun)
A three-sided flat shape used here as an example of a convex set.
A triangle interior is a simple convex set.

Chapters

From the YouTube description

MIT 18.065 Matrix Methods in Data Analysis, Signal Processing, and Machine Learning, Spring 2018
Instructor: Gilbert Strang
View the complete course: https://ocw.mit.edu/18-065S18
YouTube Playlist: https://www.youtube.com/playlist?list=PLUl4u3cNGP63oMNUHXqIUcrkS2PivhN3k

In this lecture, Professor Strang discusses optimization, the fundamental algorithm that goes into deep learning. Later in the lecture he reviews the structure of convolutional neural networks (CNN) used in analyzing visual imagery.

License: Creative Commons BY-NC-SA
More information at https://ocw.mit.edu/terms
More courses at https://ocw.mit.edu

← Lecture 20: Definitions and Inequalities · Lecture 22: Gradient Descent - Downhill to a Minimum →