ML 101
Lecture 3, Machine Learning

Gradient descent, one step at a time

How a ball finds the bottom of a valley

Part 1

The idea

Small steps beat big guesses.

The loop

  1. Measure the slope where you stand
  2. Take a small step downhill
  3. Repeat until the ground is flat

The valley

The loss as a function of one weight

The update rule

\theta_{t+1} = \theta_t - \eta \, \nabla f(\theta_t)

Step against the gradient, scaled by the learning rate

In code

for step in range(200):
    theta = theta - lr * grad(f, theta)

Small steps, flat ground. Questions?