Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 205 2 Solution Created 2026-10-03 Updated 2026-10-14
Use the normalizationThis is ridge regression; the penalty is the squared Euclidean norm. The centering removes the need for an intercept. Differentiating gives the normal equationFor every nonzero , . The coefficient matrix is therefore a positive-definite matrix, even if the design matrix has deficient matrix rank. The objective is a strictly convex function, so the unique minimizer is the closed-form ridge regression estimator, with fitted values
For the primal-dual identity for ridge regression, put and observeBoth parenthesized matrices are positive-definite matrices. Multiplying by their inverses givesThus the same fitted vector has the dual expressionNo inverse of or alone was needed. This is also the kernel-ridge hat matrix for the linear kernel.
Here a positive-definite kernel means a symmetric real-valued function whose every finite kernel matrix is positive semidefinite: for all , and ,This is the usual positive-semidefinite kernel convention; strict positivity for distinct points is not required. In particular . Write , and . Positivity of the two-point kernel matrix impliesIf , substitute to obtain . If , the affine expression can be nonnegative for every only if . Both cases give the Cauchy-Schwarz inequality for positive-semidefinite kernels:The zero-diagonal case is essential when the positive-definite kernel is not strictly positive.
To construct a feature map, let be the real vector space of finite formal linear combinations of symbols , one for each . Define a symmetric bilinear form byThe positive-definite kernel property makes this a positive semidefinite bilinear form. It need not yet be an inner product: distinct formal vectors can have zero squared length. The same quadratic-polynomial argument, now applied to , provesTherefore implies for every . The setis the radical of a bilinear form, hence a linear subspace. SetThe quotient vector space has a well-defined inner product: changing representatives by elements of changes no pairing, and a zero-length class is exactly the zero class. It is therefore an inner product space.
Define . By construction,Every positive-definite kernel thus has a feature representation, including degenerate kernels and the zero kernel. This is its canonical feature space of a positive-semidefinite kernel. The construction already gives the requested inner product space.
Past exam of the mathematics course of the University of Cambridge 2018 iii Paper 205 2 Solution Created 2026-10-03 Updated 2026-10-05
Use the convention that ridge regression minimizes . Its closed-form ridge regression estimator isThe factors and here specify the tuning convention. No intercept is needed for the centred responses and predictors.
For the two-component procedure, fix and put . Differentiating the objective with respect to its dense coefficient givesThus, with ,The inverse exists because , even for a rank-deficient design. The sum of the fitted sparse and dense components is the Lava estimator.
Multiplying by and completing the square gives the exact profile calculationLet . A singular value decomposition of shows that its eigenvalues are in nonzero singular directions and one in the orthogonal complement. Hence is a positive-definite matrix. Take its symmetric principal square root of a positive semidefinite matrix, . Profiling out therefore yields the Lasso reduction for the Lava estimator:No restandardization of is needed: this is the exact transformed objective with its original penalty.
Write , , and . Then . Comparing the transformed Lasso objective at and gives the Basic inequality for the LassoOn , Holder inequality bounds the score by . Using cancels the fitted penalty and yields the slow-rate prediction bound for the Lasso:Finally, if , then , soConsequentlyPositive actually guarantees for every finite design; the factor measures how much prediction norm the profiling transformation can remove.
Past exam of the mathematics course of the University of Cambridge 2018 iii Paper 218 6 d Solution Created 2026-10-03 Updated 2026-10-05
Let denote the effective penalty in the Gaussian squared-error objective. With the loss normalization used in the glmnet documentation, alpha zero gives ridge regression:The intercept is fitted separately and unpenalized. The constant column supplied by model.matrix is not an additional penalized slope; glmnet excludes zero-variance predictor columns. Centering and the stated predictor norms make the two slope columns already standardized under the divisor- convention.
Let consist of those two columns, , and . Minimizing over the intercept gives , and the closed-form ridge regression estimator under this normalization isThus the right-hand limit in the plotted log- coordinate is , givingThe left-hand limit is , giving the unpenalized full-model slopesThe plotted curves are these two slopes. If the objective is instead written as unnormalized RSS plus a quadratic penalty, its penalty coefficient is , not .
There is also a software response-scale convention to distinguish from this mathematical parameterization. The Gaussian fitting engine divides a supplied penalty by the response standard deviation while fitting a standardized response, then rescales the coefficients. For pure ridge with these already standardized predictors, this corresponds to effective in the displayed objective. Such a fixed positive rescaling of the horizontal parameter for the observed dataset does not change either asymptote. The fixed-penalty variance formulas below refer to in the displayed mathematical objective.
Past exam of the mathematics course of the University of Cambridge 2018 iii Paper 218 6 f Solution Created 2026-10-03 Updated 2026-10-05
One suitable criterion among the three unpenalized normal linear models is the Akaike information criterion. With estimated mean coefficients and the variance also estimated, minimizing AIC is equivalent to minimizingThe values of are for model1, model2 and model3. This compares fit and complexity rather than choosing solely by individual coefficient significance. The Bayesian information criterion or a common-fold predictive comparison would also be reasonable, depending on the selection objective.
For the ridge regression tuning parameter, use K-fold cross-validation with squared prediction loss:Use the same folds for every candidate, estimate any centering or scaling within each training fold, choose a minimizing , and refit on all observations. This estimates mean squared prediction error while avoiding data leakage. The printed summaries do not supply all residual sums of squares or validation losses, so they do not determine which model or penalty wins.
Past exam of the mathematics course of the University of Cambridge 2019 ii Paper 1 29J b Solution Created 2026-09-24 Updated 2026-09-29
Differentiating the ridge regression objective givesFor every nonzero ,so is positive definite and hence invertible. The strictly convex objective therefore has the unique closed-form ridge regression estimator
Past exam of the mathematics course of the University of Cambridge 2021 iii Paper 218 1 a Solution 2026-09-28
Put and . With objective , ridge regression givesFor the duplicated design, the objective depends on through the loss and symmetry makes the minimum-penalty decomposition equal:Duplicating a predictor therefore halves its effective ridge penalty.
Past exam of the mathematics course of the University of Cambridge 2022 iii Paper 218 6 c Solution 2026-09-28
For a Laplace prior , maximizing the posterior is equivalent to minimizingso the posterior mode is the Lasso. For a Gaussian prior , the mode minimizesand is the ridge regression estimator . Gaussian conjugacy makes the posterior normal, so its mode and posterior mean coincide at this ridge estimate.
Past exam of the mathematics course of the University of Cambridge 2023 iii Paper 205 5 a Solution Created 2026-09-28 Updated 2026-10-03
With the normalization used in the question, ridge regression solvesDifferentiating with respect to and using the centered columns gives . The normal equation for issoThe push-through identity then gives the equivalent dual form
Past exam of the mathematics course of the University of Cambridge 2023 iii Paper 218 5 a Solution 2026-09-28
For fixed , letting gives ridge regression, including ordinary least squares when ; letting forces every coefficient to zero. For fixed , letting gives the Lasso. Letting both penalties vanish gives an ordinary least squares solution, unique when has full column rank and otherwise potentially nonunique or path-dependent.
When , the term is strictly convex. Its sum with the convex squared loss and penalty is strictly convex and coercive, so the elastic net solution exists and is unique.
Past exam of the mathematics course of the University of Cambridge 2023 iii Paper 218 5 d Solution 2026-09-28
Model m1 is ridge regression, while m2 is the Lasso. Ridge shrinks but normally retains every coefficient; the Lasso's penalty sets many coefficients exactly to zero. Model m3 combines sparsity with the grouping effect of the elastic net: correlated predictors tend to enter together and receive more similar coefficients.
Accordingly, m3 keeps the weak variables age, lcp, and gleason at zero as m2 does, but retains lweight, lbph, svi, and pgg45 as the ridge fit does. The correlation between svi and lcavol explains why m3 keeps both with substantial coefficients, whereas m2 selects lcavol and discards svi. This lies between the dense ridge behavior and the more aggressively sparse Lasso behavior.
Past exam of the mathematics course of the University of Cambridge 2024 iii Paper 218 2 a Solution Created 2026-09-24 Updated 2026-09-25
Because the columns of the design matrix are centred, ridge regression with an unpenalized intercept solvesThe normal equations give, for ,The fitted values are consequentlyIf the objective is normalized by , the same formulas hold after replacing by .
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 205 5 a Solution Created 2026-09-24 Updated 2026-10-03
The ridge regression estimator minimizesIts gradient vanishes exactly when . Since makes this matrix positive definite,
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 2 a Solution Created 2026-09-24 Updated 2026-10-03
The ridge regression estimator is the elastic net at , while the Lasso regression estimator is the elastic net at .
Primal-dual identity for ridge regression Created 2026-10-06 Updated 2026-10-07
For any real design matrix and , . Multiplication by identifies the primal ridge regression fitted values with , , the kernel-ridge hat matrix for the linear kernel. No rank assumption is needed.
Principal-component shrinkage by ridge regression Created 2026-09-29 Updated 2026-10-06
For , ridge regression multiplies the fitted response along the th normalized sample principal component by the shrinkage factor . Directions with variance much larger than are nearly retained, while directions with variance much smaller than are nearly removed.
Residual sum of squares Created 2026-09-24 Updated 2026-10-14
The residual sum of squares measures how far the observed responses lie from their fitted values. If is the th regression residual, thenIt is the squared Euclidean norm of the regression residual vector. Squaring prevents positive and negative deviations from cancelling and gives large deviations more weight. In the constructed five-point example in linear regression, the regression residuals are , so the residual sum of squares is .
Ordinary least squares minimizes the residual sum of squares over the chosen linear regression family; ridge regression minimizes the residual sum of squares plus a penalty. Consequently the ridge regression fit can have a larger residual sum of squares than the ordinary least squares fit on exactly the same design matrix. For the one-predictor construction in ridge regression, the residual sum of squares rises from to when the penalty changes from to ; that increase is the cost of shrinking the fitted slope.
Dividing the residual sum of squares by gives the training error for squared-error loss, not an estimate based on fresh responses. Its units are squared response units, and it adds across observations, so raw totals need not be comparable across different response scales or sample sizes. Comparing fits to the same responses is useful, but choosing a ridge regression penalty by minimum training residual sum of squares favors the unpenalized fit. Assess prediction error using a validation set or cross-validation instead.[ref]
Model selection and validation 1: Cross-validation. slides 6–8 and 11–14: fresh-response error, training error and held-out scoring
Ridge regression Created 2026-09-24 Updated 2026-10-14
Ridge regression fits a linear regression model while penalizing the size of its slope regression coefficients. For a fixed design matrix containing the slope predictors, observed responses , and an unpenalized regression intercept , the objective isHere is the all-ones vector, and is the squared Euclidean norm of the slopes alone. The first term is the residual sum of squares; the second implements regularization. No random-error assumption is needed to define this fit. The convention is a summed squared-error loss: writing the objective as gives the same fit when .[ref]
Modern regression 1: Ridge regression. slides 5 and 7: summed squared-error objective and unpenalized intercept
For an exact example, reuse the constructed pairs from linear regression. Their sample means are and , and the centered cross-products are and . ThusThe ordinary least squares line has slope and residual sum of squares . At , ridge regression has slope , regression intercept , and residual sum of squares ; at these become , , and . Every line passes through : the penalty reduces the slope while retaining the response sample mean.
The computational benefit is visible after predictor centering. Write for the design matrix with each column's sample mean subtracted, and . The unpenalized intercept in ridge regression gives , and the closed-form ridge regression estimator solvesFor any nonzero vector and , . This positive-definite matrix is therefore invertible even when lacks full column rank, including repeated columns or . The unique penalized slopes resolve the ambiguity of rank-deficient ordinary least squares; they do not supply evidence about slope directions absent from the data. This makes ridge regression useful for multicollinearity.[ref]
High-Dimensional Regression: Ridge. p. 1, equations (1)–(2): uniqueness for positive penalty regardless of design rank
Predictor centering and scaling serve different purposes. Centering handles the free regression intercept. Scaling determines what counts as a large slope: replacing by changes its coefficient to for the same predictions, changing its contribution to an unweighted penalty. A common convention forms standard scores using each nonconstant predictor's sample standard deviation , then penalizes slopes in those coordinates. Since , this is the weighted penalty in the original units. Constant columns have and must be removed before this scaling. Scaling is a modelling choice; equal penalties in original units and in standardized units define different fits.[ref]
Modern regression 1: Ridge regression. slide 7: center predictors, leave the intercept free and scale predictors to sample variance one
The singular value decomposition explains the shrinkage. If is the compact decomposition using the positive singular values , with columns of , thenThe principal-component shrinkage by ridge regression factors are between and : directions with small singular values are damped most. As , the fitted values approach ; the vanishing-penalty ridge limit recovers the ordinary least squares fitted vector as , even if the slope estimates at zero penalty are nonunique. The covariance and bias of a ridge regression estimator describes the resulting bias-variance tradeoff. A penalty can reduce variance of an estimator while introducing bias of an estimator; the unbounded directional risk of fixed ridge shrinkage rules out a uniform improvement for a fixed positive penalty over all possible signals.[ref]
For a second exact construction, choose a centered orthonormal set of three vectors,and set and . The squared singular values are and . At , the fitted coordinates along are , retaining and of their ordinary least squares values . At they become , retaining and . The unfittable component contributes to every residual sum of squares, giving total values , , and at penalties . These are constructed fits, not measured prediction results.
Exact synthetic ridge shrinkage retains the strong singular direction longer than the weak one
. Details. The penalty is a hyperparameter, so fitting slopes at a fixed value and selecting that value are separate tasks. Use a validation set or K-fold cross-validation to compare candidate penalties by held-out squared-error loss. In each split, compute predictor sample means and scales from that split's training data, apply the same transformation to its validation set, and refit the slopes; using held-out information in preprocessing introduces data leakage. Minimum training residual sum of squares cannot select useful shrinkage: ordinary least squares already attains the smallest possible value.[ref]
Model selection and validation 1: Cross-validation. slides 5–8 and 11–14: tuning for prediction, training error and refitting on each training fold
After model selection, refit on all training data with the selected penalty. A separate test set or nested cross-validation assesses the entire selection procedure; a low selected validation score alone is no performance guarantee.[ref]On Over-fitting in Model Selection and Subsequent Selection Bias in Performance Evaluation by Gavin C. Cawley and others. pp. 2079–2080: selection as part of fitting and nested assessment

