Gauss-Newton Algorithm
Minimises a sum of squared residuals using a linear approximation at each step.
The idea
For a least-squares loss it linearises the model with the Jacobian J and solves the resulting linear least-squares problem, using JᵀJ as a cheap stand-in for the Hessian. It is very fast near the solution, but can overshoot when the linear approximation is poor.
Δθ = −(JᵀJ)⁻¹ Jᵀ r
Watch it run
This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.
- current weights
- minimum
- last update
Start somewhere on the bowl. Rings are lines of equal loss; the minimum is at the centre.
- step:
- 0
- loss:
- 3.4617
Loss landscape seen from above: a long narrow valley. Final loss 0.
Step by step
- 1Compute residuals r(θ) and the Jacobian J.
- 2Solve (JᵀJ)Δ = −Jᵀr.
- 3Update θ ← θ + Δ.
- 4Repeat until the residual stops shrinking.
Where it is used
Nonlinear least squares, bundle adjustment, camera calibration.
Watch out for
JᵀJ may be singular or the step too big; Levenberg-Marquardt fixes this.