Suppose noisy observations trace out a cosine. A straight line will miss the oscillation; an elaborate model may chase every noisy deviation. Before asking how to fit a model, we must decide which aspects of the curve it should be able to express.
The sensitivity model used fixed input features and unknown coefficients. The same construction can describe curved functions. Its advantage is that expressive choices and parameter estimation can be studied separately.
In this chapter: features and least squares, likelihood and regularisation, generalisation, Bayesian evidence.
Curved functions, linear coefficients
Choose features and define
The vector of fitted observations is . The features may be nonlinear in ; the model is linear in its parameters. This terminology avoids confusing it with a statistical generalised linear model, which additionally specifies a response distribution and link function.
Classification offers a geometric version of the same distinction. An inner disk surrounded by a ring cannot be separated by a line in the input plane. Add the feature , and a plane can separate them in three dimensions. In the original coordinates, the linear feature-space score becomes the curved boundary
Play the lift, then change the viewing angle. The input points never move in their first two coordinates; what changes is the representation available to a linear decision rule. This illustrates feature construction, not a regression fit or a trained network.
φτ(x, y) = (x, y, τ(x² + y²))
inner height ≤ 0.000outer height ≥ 0.000
For a known period , can express any phase-shifted sinusoid at that frequency. Noise-free cosine data recover if the sampled features have full column rank. Observations only at multiples of cannot identify the sine coefficient. A good function family is not enough: the experiment must distinguish its members.
Polynomial features express local trends; the Taylor series for cosine explains their local approximation power. A longer domain needs higher degree, which can worsen conditioning and extrapolation. Gaussian radial basis functions,
give local control. Narrow widths allow rapid variation but can leave gaps between centres; broad widths can produce nearly dependent columns. Neither smoothness nor good conditioning follows from the name of a basis alone. Even continuously orthogonal Fourier or Chebyshev functions can yield a poorly conditioned sampled design if observations cluster or alias.
For squared error, differentiation gives
The Hessian is positive semidefinite: . Thus every local minimiser is global. The coefficients are unique exactly when has full column rank. If not, all minimisers give the same fitted data but can disagree at new inputs. The pseudoinverse selects the minimum-norm minimiser.
The familiar inverse formula is therefore conditional, and is usually a poor computational recipe. QR solves in the full-rank case; SVD handles rank deficiency. Forming normal equations squares the spectral condition number. Use a stable least-squares solver rather than explicitly computing an inverse.
Why squared error, and why penalise weights?
Assume conditionally independent observations
The negative log likelihood is
For fixed variance, maximum likelihood therefore minimises MSE. This justification depends on independent equal-variance Gaussian errors; unequal variances lead to weighted least squares and correlated Gaussian errors to a covariance-weighted quadratic form. A central-limit argument may motivate Gaussian errors, but does not establish these assumptions for a particular dataset.
When variance is also estimated, its interior likelihood optimum is the mean squared residual, . It is not the degrees-of-freedom-corrected unbiased estimate. If the residual is exactly zero, the unconstrained Gaussian likelihood grows without bound as variance tends to zero; there is no positive interior optimum.
A Gaussian prior changes maximum likelihood to maximum a posteriori estimation (MAP). Multiplying the negative log posterior by produces
Consequently , unique for . For an MSE objective instead of a sum, the corresponding penalty coefficient is . The source's informal equivalence between a penalty coefficient and prior precision omits this scaling. Laplace priors similarly give penalties; the assumed weight scales matter in either case.
The penalty becomes tangible if the observations and basis stay fixed while only its strength changes. Watch the fitted curve and its coefficients together. Smoother-looking predictions need not always improve the reference error; regularisation is a modelling choice with a measurable trade-off.
minw ‖Φw − y‖² + λ Σj≥1 wj²
λ = 0.000100reference MSE = 0.0319
Fitting observations is not predicting new ones
Imagine repeatedly collecting a training set , fitting the same algorithm and predicting at one fixed input . Write , , and let the new observation be independent of . Expanding the squared error and cancelling centred cross terms gives
These are squared bias, estimator variance, and irreducible observation noise. The average estimator is not automatically the true regression function, even with large datasets. Bias concerns its systematic error; variance concerns its sensitivity to the random training set. The decomposition requires finite second moments, but does not require Gaussian noise.
Underfitting means the representation or fit is too restrictive for the relevant pattern: training and validation errors are both poor. Overfitting means a fit exploits details that do not generalise, often giving low training error and appreciably worse validation error. Adding features can reduce approximation bias while increasing variance; stronger ridge regularisation often trades variance for bias.
Use held-out validation or cross-validation to choose features, widths and penalties. Fit standardisation and other preprocessing inside each training fold to avoid leakage. A validation set is used for selection, so a final untouched test set is needed for a less biased performance assessment. Collecting more representative data, simplifying the basis or adding regularisation can address overfitting; richer features can address underfitting. A validation curve need not be U-shaped. Interpolating models can exhibit double descent, and raw parameter count alone does not determine generalisation.
Ordinary RBF regression has no uncertainty distribution unless one is supplied. Its features decay away from their centres, so its fitted mean tends to zero, or to an explicitly included intercept; this is an extrapolation assumption, not a guarantee of graceful uncertainty growth. Polynomial predictions can grow rapidly outside the design interval. Both should be checked where the model will actually be used.
Integrating weights instead of choosing only one
The Gaussian model permits an exact Bayesian calculation. Set prior precision and noise precision . Completing the square gives
At a new input, the latent fitted function has mean and variance . Predicting a noisy observation adds . This separates uncertainty about the function from future measurement noise.
Integrating the likelihood over the prior gives the evidence, . Its log is
Evidence compares the probability mass a model assigns to the observations after averaging over weights. The terms act together: the term is a prior normalisation, not an independent reward for adding features. Evidence-based selection depends on the prior, parameterisation and candidate families; it does not automatically find a physically correct basis or replace external validation.
There is another way to read this integral. The prior induces covariance
between function values. We have moved from uncertain coefficients to uncertain functions. Gaussian processes take this viewpoint directly, and make it useful when simulator evaluations are scarce.