Checking a Gradient with a Finite Difference
An independent finite difference can estimate how a small change in one parameter affects loss and can be compared with the computed gradient.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Trace a scalar example
For \(L(w)=w^2\), the central difference at three gives six in exact arithmetic for any nonzero step. Centered differences explain the cancellation.
Control randomness and precision
Use a reproducible small input and a step suitable for the runtime. At a nondifferentiable boundary, a gradient convention can differ from a finite difference. See ReLU derivatives.[1]