Okay, let's derive the update rule for Gradient Descent used to minimize a given loss function.
Goal: We want to find the parameters (weights, biases, generally denoted by a vector w) that minimize a given loss function, L(w).
Core Idea: Gradient Descent is an iterative optimization algorithm. It starts with an initial guess for the parameters and repeatedly adjusts them in the direction that decreases the loss function most rapidly.
The Role of the Gradient:
- In calculus, the gradient of a function (denoted by ∇L(w)) is a vector that points in the direction of the steepest increase of the function at a given point w.
- Since we want to minimize the function, we should move in the direction opposite to the gradient – the direction of steepest decrease (steepest descent).
Mathematical Formulation:
Let w(k) be the parameter vector at the k-th iteration of the algorithm. We want to find w(k+1) such that , ideally getting closer to the minimum.
-
Direction of Movement: As established, the direction of steepest descent at w(k) is given by the negative gradient, −∇L(w(k)).
-
Step Size: We need to decide how large a step to take in this direction. This step size is controlled by a parameter called the learning rate, typically denoted by (or ). The learning rate is a small positive scalar.
This is the core Gradient Descent update rule.
Breaking Down the Components:
- w(k+1): The new values of the parameters after the update.
- w(k): The current values of the parameters before the update.
- α (learning rate): A positive scalar that determines the size of the step. A small leads to slow but potentially more stable convergence. A large can lead to faster convergence but risks overshooting the minimum or even diverging.
Intuition:
At each step, we calculate how much the loss function would change if we slightly increased each parameter (this is what the partial derivatives in the gradient tell us). The gradient vector combines these rates of change. By moving in the opposite direction of the gradient, we are effectively adjusting each parameter in proportion to how much it contributes to increasing the loss, but in the decreasing direction. The learning rate scales the magnitude of this adjustment. We repeat this process until the parameters converge to a point where the gradient is close to zero (which occurs at a minimum or saddle point).
Summary of Derivation Steps:
- Identify the goal: Minimize L(w).
- Recall the property of the gradient: ∇L(w) points towards the direction of steepest increase.
- Deduce the direction for minimization: Move in the opposite direction, −∇L(w).
- Introduce the learning rate α to control the step size.