Quiz: interpolating, approximating and smoothing splines
Before this unit: B-splines and NURBS (previous unit); Day 1: Images, filters and frequencies.
See also: Day 5: Deconvolution; Day 14: Labelling.
Short questions to test your understanding. Try each on paper first, then open the answer.
Q1. You have 40 noisy samples of a growth curve. Why is the interpolating spline a poor choice, and what are the two alternatives?
What does the curve do with the noise?
It passes through every sample, so it reproduces the noise as wiggles (and its derivatives are worse). Alternatives: an approximating spline with fewer control points, fitted by least squares; or a smoothing spline that keeps one value per sample but penalises bending (data + λ·bending).
Q2. Among all smooth curves through a set of points, which one bends least? What does “bends least” mean here?
The draftsman’s wooden strip.
The natural cubic spline (zero curvature at the two ends). “Bends least” means the smallest bending energy \int f''(x)^2\,dx.
Q3. In a smoothing spline, what do you get for λ = 0 and for λ → ∞?
Which curves have zero bending energy?
λ = 0: no penalty, so the interpolating (natural) spline through every point. λ → ∞: any bending is infinitely expensive, so the curve must be a straight line; among lines, the least-squares line.
Q4. Three samples (0, 3, 0) are smoothed with the discrete penalty λ·(second difference)². What happens to their mean as λ grows? Why?
What is the second difference of a constant?
The mean stays 1: λ = 1 gives (0.857, 1.286, 0.857), λ → ∞ gives (1, 1, 1). The penalty does not see constants (or lines), so it cannot move the mean; it only removes the bend.
Q5. Leave-one-out cross-validation gives a U-shaped curve over λ. Explain both arms of the U.
Predict a hidden point with a curve that is too wiggly, and with one that is too stiff.
Small λ: the curve chases the noise of its neighbours, so it predicts a hidden point badly (high variance). Large λ: the curve is too stiff to follow the true shape (high bias). The minimum balances the two.
Q6. The noise in your data doubles. Should the λ chosen by cross-validation go up or down?
More noise, more smoothing.
Up: noisier data need more smoothing. In the demo’s kink data, the CV choice goes from λ ≈ 0.35 (noise 0.25) to λ ≈ 1.0 (noise 0.5), and the effective number of parameters from 7.2 to 5.8.
Q7. Why is the perimeter of a segmented disc by edge count 27 % too long, whatever the radius? How does a spline fit avoid this?
Add up the horizontal and the vertical edges of the staircase.
The staircase’s horizontal edges add up to twice the width and its vertical edges to twice the height: 4 \cdot 2r = 8r instead of 2\pi r, a ratio 4/\pi = 1.27. A spline fitted to the boundary is a smooth curve close to the true outline; its length is the integral of its speed (62.9 for a radius-10 disc, true 62.8).
Q8. Smoothing an outline with Fourier descriptors (few terms) or with a smoothing spline: which one changes the outline far from a sharp corner? Why?
Global waves versus local bumps.
Fourier descriptors: each term is a wave around the whole outline, so dropping the high frequencies that the corner needs makes ripples everywhere (ringing). The spline’s basis functions are local bumps: smoothing rounds the corner and leaves the rest almost unchanged.
Q9. (math) Write the normal equations of the penalised least-squares problem \min_{\mathbf{c}}\|\mathbf{y} - B\mathbf{c}\|^2 + \lambda\mathbf{c}^\top P\mathbf{c} (P symmetric).
Set the gradient with respect to \mathbf{c} to zero.
Gradient: -2B^\top(\mathbf{y} - B\mathbf{c}) + 2\lambda P\mathbf{c} = 0, so (B^\top B + \lambda P)\mathbf{c} = B^\top\mathbf{y}.