4
$\begingroup$

The following is an excerpt from "Ridge Regularization: An Essential Concept in Data Science" by Trevor Hastie.

hastie ridge regression

How does one actually prove this? It seems to depend on understanding how the singular values and right singular vectors change when duplicating a column, but it doesn't seem to be clear exactly how those change (e.g., https://math.stackexchange.com/questions/244399/how-does-the-left-singular-value-decomposition-change-when-one-duplicates-a-colu)

$\endgroup$
12
  • $\begingroup$ The quote doesn’t say ridge coefficients for identical variables are halved. It says they sum to the coefficient value in the model where only one is included. $\endgroup$
    – Sycorax
    Commented Oct 8 at 21:41
  • $\begingroup$ It says the coefficients are identical and sum to the coefficient value (I missed it on first read myself). When there's two that would imply each one is halved $\endgroup$
    – Glen_b
    Commented Oct 8 at 21:53
  • $\begingroup$ Ah, I missed “identical.” $\endgroup$
    – Sycorax
    Commented Oct 8 at 22:02
  • 2
    $\begingroup$ @Sycorax --- yeah, the identical part follows from the fact that ridge is guaranteed to have a unique minimizer, and that $\hat{\beta}_1, \hat{\beta}_2$, if different, could be swapped to produce another minimizer (a contradiction) $\endgroup$ Commented Oct 9 at 1:52
  • 1
    $\begingroup$ You are correct, but it points you in the right direction. I guess I need to be explicit. Consider the SVD of a single-column matrix $X=U\operatorname{Diag}(d)V^\prime.$ A SVD for the two-column matrix $[X;X]$ is $$[U;U_0] \operatorname{Diag}(d\sqrt{2},0) \pmatrix{\sqrt{1/2}&-\sqrt{1/2}\\\sqrt{1/2}&\sqrt{1/2}}^\prime$$ where $U_0$ is any vector orthogonal orthogonal to $U.$ I hope the generalization to $p\gt 1$ is clear. $\endgroup$
    – whuber
    Commented Oct 9 at 22:04

3 Answers 3

4
$\begingroup$

I won't offer a formal proof but this motivation for it in the "two copies of the variable" case could be turned into one (and a similar argument for more copies).

Imagine you have a regression model with some predictor $X_1$ with coefficient $\hat{\beta}_1$ and potentially other predictors ($V_1, V_2,...$, say), if needed. Let $X_2=X_1$ and add it to the model.

A weighted mixture of these two predictors $w X_1 + (1-w)X_2$ as a predictor would reproduce the fit of the original model (with the same coefficient); some other mixing proportion would result in a worse fit. This takes care of the contribution to the ridge loss function from the fit itself - that kind of mixture with any $w$ would do for minimizing the squared error loss term.

Now consider that if you add both terms to the model independently, the $w$ and $1-w$ will impact the estimated coefficients (look at it not as $\beta_1 (w X_1)$ but as $(\beta_1 w) X_1$).

Everything else being equal, to minimize the ridge penalty, we're minimizing $\hat{\beta_1}^2(w^2 +(1-w)^2)$ over $w$ where $\hat{\beta_1}^2$ is again the coefficient from the original model. Which choice of $w$ will minimize the ridge penalty?

$\endgroup$
6
  • $\begingroup$ I agree completely --- however, the issue is that can you prove that $w = 1/2$ is actually the new ridge solution? all this proves is that there exists a solution with $w = 1/2$ which has a lower $\ell_2$ norm squared than the original non duplicated predictor. $\endgroup$ Commented Oct 9 at 1:41
  • $\begingroup$ I think even in this very simple case (say 2 predictors, and I duplicate one) it seems hard to show? $\endgroup$ Commented Oct 9 at 1:56
  • $\begingroup$ The ridge solution in the above case is $\hat\beta = (X^TX + \lambda I)^{-1} Xy$. The ridge solution for a duplicated column is $\hat\beta' = \left([2X_1; X_2]^T[2X_1; X_2] + \lambda \begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix}\right)^{-1}[2X_1; X_2]y$. The non-identity matrix throws things off. $\endgroup$ Commented Oct 9 at 1:57
  • $\begingroup$ Related to my answer at stats.stackexchange.com/a/264118/11887 $\endgroup$ Commented Oct 9 at 13:19
  • 1
    $\begingroup$ @kjetilbhalvorsen thanks, i think i've seen similar intuition, but i'm looking for an exact characterization. For example, I think the one half result I'm considering above is true in the limit as we take $\lambda \rightarrow 0$, i.e., the min-norm OLS solution, but I'm wondering if that's the only case. $\endgroup$ Commented Oct 9 at 14:34
1
$\begingroup$

We can see that it is not literally true by contradiction.

Say we have three predictors $X_1$, $X_2$ and $X_3$. Let us assume that $X_1 = X_2 = X_3 = X$. Consider the three fit ridge models

$$ \begin{align*} &\beta_1 X + \beta_2 X + \beta_3 X \\ & \beta_{12} X + \beta_3^{'} X \\ & \beta_{123} X \end{align*} $$

Taken literally, the claim in ESL implies each of the following:

$$ \begin{align*} &\beta_1 = \beta_2 = \frac{1}{2} \beta_{12}\\ & \beta_{12} = \beta_3^{'} = \frac{1}{2} \beta_{123}\\ &\beta_1 = \beta_2 = \beta_3 = \frac{1}{3} \beta_{123} \end{align*} $$

These are easily seen to be inconsistent. Writing everything in terms of $\beta_{123}$ we have $\beta_{12} = \frac{2}{3} \beta_{123}$ from the first equation and $\beta_{12} = \frac{1}{2} \beta_{123}$ from the second equation.

So the precise claim in ESL is false. I think the intuition provided by @Gleb_b's answer is what they were trying to get at. There is some qualitative/intuitive content here but not a precise theorem.

$\endgroup$
8
  • $\begingroup$ Sorry, I don't think your example is correct. If all 3 covariates are identical, then we shouldn't assume that $\beta_1 + \beta_2 = \beta_{12}$ because $\beta'_3$ should also be identical to $\beta_{12}$ and we should be distributing $\beta_1 + \beta_2 + \beta_3$ equally over $\beta_{12}$ and $\beta_3'$. The natural generalization of the theorem I'm discussing is to cluster all columns into identical groups, and then if the columns of each group was replaced with just a single unique column, that new ridge coefficient should be the sum of the (identical) original ridge coefs in each group. $\endgroup$ Commented Oct 9 at 14:32
  • $\begingroup$ @JohnRadinger If it helps imagine that $X_1$ and $X_2$ are identical and $X_3$ is just ever so slightly perturbed (you could, for example, add $\epsilon$ to only the first coordinate). The theorem says that since $X_1$ and $X_2$ are identical their regression coefficients should be equal to half of what they are if only one were included in the model. Line 1 of my three equalities follows. These ridge regression coefficients should be continuous in $\epsilon$, so as $\epsilon \to 0$ we have the three equalities I started with. $\endgroup$ Commented Oct 9 at 16:19
  • $\begingroup$ This circumlocution with $\epsilon$ is not really needed: my original argument is fine. I just hope that it helps you to see that the argument is valid. $\endgroup$ Commented Oct 9 at 16:20
  • $\begingroup$ Note that the above excerpt I cited is not from ESL, but rather from a paper published in Technometrics (ncbi.nlm.nih.gov/pmc/articles/PMC9410599), so it would be surprising if they're expressing some intuition (which they would explicitly state, I'd imagine) rather than state something which is mathematically clear but wrong. $\endgroup$ Commented Oct 9 at 16:20
  • $\begingroup$ There isn't anything wrong with my argument. I will code up an explicit counterexample and post the results momentarily in a new answer. $\endgroup$ Commented Oct 9 at 16:22
1
$\begingroup$

A simulation based counterexample:

import numpy as np
from sklearn.linear_model import Ridge

from numpy.random import RandomState

prng1 = RandomState(4243)
prng2 = RandomState(1258)
prng3 = RandomState(3991)

nobs = 5
x = prng1.normal(size = nobs)
X = np.ones((nobs,4))
X[:,1] = x
X[:,2] = x
X[:,3] = prng2.normal(size = nobs)
y = 3 + np.dot(X, [0, 2, 1, 4]) + prng3.normal(size = nobs)

model1 = Ridge(alpha = 1, fit_intercept = False)
model1.fit(X,y)

model2 = Ridge(alpha = 1, fit_intercept = False)
model2.fit(X[:,[0,1,3]], y)

print(model1.coef_)
print(model2.coef_)

Results:

[2.59857301 0.50722255 0.50722255 1.7140635 ]
[2.66713959 0.7987741  1.55787553]

Note that 0.5 is not half of 0.79.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.