Fundamentals / Numerical mathematics / Inverse problems and least squares

Derivatives and early stopping

Check a forward solver gradient independently, then decide when its iterative inverse has started fitting noise.

1. Differentiate through a scalar equilibrium

A steady sensor reads \(u\) satisfying \(pu=2\). The normalised measured value is 0.8 and \(J=(u-0.8)^2/2\). (a) At \(p=2\), compute the adjoint, gradient and direct derivative. (b) What sign would a one-step gradient descent change have? (c) Does that sign make physical sense?

Check the sign against the forward response

The state is 1, residual 0.2. The adjoint equation \(p\lambda=0.2\) gives 0.1. With no forcing derivative the gradient is \(-\lambda u=-0.1\). Directly \(du/dp=-2/p^2=-0.5\), yielding the same gradient. A descent step increases \(p\); increasing \(p\) lowers the model output toward the observation.

Explore the related calculation with adjustable inputs. Inspect the Taylor remainder with the correct and wrong-sign adjoint. The explorer uses a two-state equilibrium; apply the stated scalar or nonsymmetric operator to obtain this exercise’s exact gradient.

2. A directional derivative check

At \(p=1\) for \(J(p)=p^3\), choose direction \(v=2\). (a) Derive the Taylor remainder after subtracting the predicted linear term. (b) Evaluate it for \(h=0.10\) and 0.05. (c) Predict what halving \(h\) would do if the component gradient 3 were accidentally coded as 2.

Examine the order of the diagnostic

The exact directional slope is \(3v=6\). Expanding \((1+2h)^3\) leaves \(12h^2+8h^3\) after subtracting 1 and \(6h\). The remainders are 0.128 and 0.031, close to a factor of four apart. With incorrect slope 4 the error becomes \(2h+12h^2+8h^3\). At small enough \(h\) it will fall by about a factor of two instead, until numerical noise intervenes.

Explore the related calculation with adjustable inputs. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.

3. Stop before the weakest direction is inverted

Use \(B=\operatorname{diag}(1,0.2),\ b=(1,0.1),\ x_0=0,\ \omega=1\). (a) Derive the second coordinate and residual after \(k\ge1\) iterations. (b) Find the first iteration whose residual norm is at most 0.09. (c) Compare the result there with the converged second coordinate and explain when early stopping helps.

Solve the scalar recurrence

The first coordinate reaches 1 in one step. The second tends to 0.5 as \(x_{2,k}=0.5(1-0.96^k)\). Thus \(\|r_k\|=0.1(0.96)^k\), and crossing 0.09 requires \(k\ge\ln(0.9)/\ln(0.96)=2.58\), or three updates. The early estimate is 0.0576 while the converged one is 0.5. If most of the observed weak-mode coefficient is noise the early estimate is protective; if it mostly represents signal the same stopping rule underestimates it.

Explore the related calculation with adjustable inputs. Vary noise and iteration count to distinguish a decreasing training residual from a worsening reconstruction. CGLS in the explorer and the exercise’s Landweber recurrence have different polynomial filters.

When explicit reconstruction has its own stability limit

Let \(A=\operatorname{diag}(2,1/2)\). Explain why the continuous residual decays in both modes but a Landweber step \(h=0.6\) can fail. Repeat with \(h=1/4\). Find when the weak component has first acquired at least half its unregularised amplitude, and compare with the continuous half-time.

Worked solution

The continuous residual factors are \(e^{-4t}\) and \(e^{-t/4}\). At \(h=0.6\) the strong discrete factor is

\[1-0.6(4)=-1.4.\]

Any excited strong residual changes sign and grows. The step exceeds the upper bound \(2/4=0.5\).

At \(h=1/4\) the strong factor is zero, and the weak factor is

\[1-(1/4)(1/4)=15/16.\]

Solve \((15/16)^k\le1/2\): the real threshold is \(10.7401\), hence the first integer is \(11\). Its artificial time is \(11/4=2.75\). The continuous half-time is \(4\log2=2.7726\). The small difference reflects the exponential approximation and inspection at discrete steps.

Explore the related calculation with adjustable inputs. Vary noise and iteration count to distinguish a decreasing training residual from a worsening reconstruction. CGLS in the explorer and the exercise’s Landweber recurrence have different polynomial filters.

Revisit chapter 10 · Regularise with an artificial evolution time.

Notebook practice · Does the gradient see where the instruments were actually placed?