Gradient Descent & the Delta Rule
Source: Unit 2 §6
Why the delta rule exists
- When the data is not linearly separable, the perceptron training rule may never converge.
- The delta rule converges instead toward a best-fit approximation of the target concept, separable or not.
- It gets there with gradient descent, searching the hypothesis space of weight vectors for the weights that best fit the data.
Gradient descent, the idea
We are minimising a cost function :
- Start with some , chosen at random.
- Keep changing in whatever direction reduces .
- Repeat until you reach a minimum.
The trekking analogy. You are standing somewhere on a hilly surface. You look around, take a small step in the steepest downhill direction, and repeat. Eventually you stop moving, because every direction is uphill: you are at the bottom of a valley.
Gradient descent finds a minimum, not the minimum. Two random initialisations can descend into two different local minima, and nothing in the algorithm can tell you that the valley you landed in is not the deepest one. This is a defining property of gradient descent, and its main weakness.
The update rule
Until convergence, update every parameter:
The derivative term is the slope of the tangent at the current point, so the step size is proportional to how steep the surface is right here.
Compute all the updates from the old parameter values, then assign them together. Using a freshly updated while computing the update for is a different algorithm, and not the one that is guaranteed to descend.
What the derivative's sign does
For a single-variable :
| Situation | Derivative | Update | Effect |
|---|---|---|---|
Positive slope at point a | > 0 | x ← x − α(+) | x moves left, toward the minimum |
Negative slope at point b | < 0 | x ← x − α(−) | x moves right, toward the minimum |
| At the minimum | = 0 | x ← x − 0 | x is unchanged - and stuck, if this minimum is only local |
The sign takes care of itself: subtracting the gradient always points you downhill, whichever side of the valley you are on.
The learning rate α
(also written ) controls how big a step you take downhill.
Gradient descent for perceptron learning
Define an error (cost) function over the weights. For output and target , summing over the training rows :
| Symbol | Meaning |
|---|---|
E(w⃗) | the error, treated as a function of the weights w⃗ |
t_d | target (expected) output for training row d |
o_d | actual perceptron output for the current weights |
- Squaring is mainly for ease of differentiation - the out front cancels the 2 that the power rule brings down.
- It also penalises big errors disproportionately, so one badly wrong prediction moves the weights more than several slightly wrong ones.
- The perceptron computes .
- Feed the training rows through it and evaluate .
- Apply the update rule to each of , and , all from the same old values.
- Repeat. The weights descend to the minimum of , which is the set of optimal weights.