Gradients
The gradient of a scalar function is the vector of its coordinate partial derivatives in input order.
On this page 9 sections
01Understand the idea#
The gradient collects all partial derivatives of a scalar function into one vector, in input order. It answers how the output responds to small changes in each input. In model training, the output is often a loss and the inputs are the adjustable weights.
The gradient collects coordinate partials into one vector. For at , its entries are 4 and 3.
For coordinates , place first and second. Both entries describe rates of the same scalar function.
For , differentiate with respect to while holding fixed to get . Differentiate with respect to to get . At , the gradient is . Evaluate both entries at the same point; the function value 7 is not a gradient entry.
Order : , . Find .
Show answer and explanation
Put the x partial first.
02A gradient can depend on the input#
A gradient can depend on the input. For , compute both partials, then assemble them in order.
Order : , , . A learner drops the zero. Repair .
Show answer and explanation
Keep the y slot, even when its value is zero.
03At a point, evaluate every partial at that same point#
At a point, evaluate every partial at that same point. For and , the gradient keeps both rates.
Cost . At , find .
Show answer and explanation
and .
04A closer look#
For differentiable functions with the usual Euclidean geometry, the gradient points in the direction of steepest local increase. Gradient descent moves oppositely. A finite step still needs a learning rate: local sensitivity alone does not guarantee improvement for an arbitrarily large move.
One coordinate, one partial, one gradient slot.
- Assemble a gradient from partial derivatives in coordinate order.
Further questions
Can I add the partials instead?
Sources & further reading
- [1]