Local Change from a Matrix Gradient
A scalar-loss gradient has one sensitivity per matrix entry.
On this page 7 sections
01Predict a scalar change from a matrix change#
A scalar-loss gradient has one sensitivity per matrix entry. To estimate the effect of a small matrix perturbation, multiply matching sensitivities and changes, then add them all.
This is the same first-order reasoning as a gradient dot product for a vector. Keeping the matrix layout makes corresponding parameter positions visible.
02Combine signed contributions#
Suppose a gradient has rows and a proposed perturbation has rows . The four contributions are .
Their sum is , so the first-order model predicts a loss decrease of about . If the original loss is , its estimated new value is . The change and the new value are different answers.
Gradient rows: (1,2),(−1,0). Perturbation rows: (0.1,−0.2),(0.3,1). Estimate ΔL.
Show answer and explanation
Sum 0.1−0.4−0.3+0=−0.6.
03An approximation to finite changes#
A zero inner product means no first-order change; higher-order change may remain. For at the zero matrix, the gradient is zero. A nonzero finite perturbation still increases the loss by half its squared norm.
For an affine scalar function of the entries, this calculation is exact. For a nonlinear function, smaller perturbations make the local interpretation more useful, but a large step needs its own evaluation.
A draft reports the array G ⊙ H as a scalar loss change. What final operation is missing?
Show answer and explanation
The scalar estimate is the sum of matching products.
An entrywise product alone is an array of contributions. The final sum is necessary because the loss change is a scalar. A row-by-column matrix product generally has the wrong shape and meaning here.
Estimate the first-order change of a scalar objective under a small matrix perturbation using the Frobenius inner product of its gradient and that perturbation.
- Estimate the first-order change of a scalar objective under a small matrix perturbation using the Frobenius inner product of its gradient and that perturbation.
Sources & further reading
- [1]MIT 6.390, Appendix A: Matrix Calculus ↗introml.mit.edu · Article
- [2]Boyd and Vandenberghe, Introduction to Applied Linear Algebra ↗stanford.edu · Article