Fit the points with (a) a quadratic and (b) a straight line. Find each fit and its residual sum of squares. Why is the quadratic exact, and what goes wrong if you try a cubic?
Supervised learning, Basis-function regression
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.
What's being asked
Polynomial regression is linear regression on the basis . Exact interpolation occurs when the number of parameters equals the number of distinct points.
Key idea
Polynomial regression uses the design matrix with columns . With distinct points, a degree polynomial fits exactly, and degree makes singular.
Steps
- Quadratic: the three equations are , , . With : and , so . Subtracting, and . So , with RSS .
- Line: , , , . Slope , intercept .
- Line fitted values ; residuals ; RSS .
- Why exact: the Vandermonde matrix with rows has determinant , so it is invertible and the system has a unique solution.
- Cubic: there are 4 unknowns and 3 equations, so is with rank 3 and () is singular. There are infinitely many cubics through the points. Regularisation (ridge) or a lower degree is needed.
- Lesson: zero training error with parameters means the model is interpolating (including noise), so choose the degree by cross-validation.
Common mistakes
- Thinking polynomial regression is non-linear regression. It is linear in the coefficients.
- Choosing the degree by training RSS, which always falls to 0 at degree .
- Ignoring conditioning: raw powers of large make badly conditioned. Centre and scale , or use orthogonal polynomials.
How long your answer should be
Half a page, 5 minutes.
Last checked on 4 December 2026.
Read this
Previous in Supervised learning: For -class softmax regression with , derive the gradient of the negative log-likelihood with respect to . How do you show that the parameters are redundant (not identifiable), and how is this fixed?
Next in Supervised learning: The elastic net minimises . How do you show that it is a lasso problem on augmented data, and what does this imply for the number of variables it can select and for correlated features?