Tutorials › High-Dimensional Genomic Data Analysis › Proximal Gradient Updates for Penalized Least Squares

Penalized Regression for p Much Larger Than n · Tutorial 530 of 795

Proximal Gradient Updates for Penalized Least Squares

Learn how to construct a lasso proximal-gradient step, choose a valid step size, and calculate an update with soft-thresholding.

Advanced 10 min read

What You'll Learn

  • Write the lasso objective as a smooth squared-error loss plus a nonsmooth penalty.
  • Derive the soft-thresholding proximal operator, including its behavior at zero.
  • Calculate a proximal-gradient update from the design matrix, response, penalty, and step size.
  • Find the squared-error gradient’s Lipschitz constant and use it to set a step size.
  • Recognize what the update does and does not guarantee when the design is rank deficient.
  • Distinguish proximal gradient from coordinate descent and a plain gradient step.

Why Separate the Loss and the Penalty?

In high-dimensional expression analysis, the number of measured genes can exceed the number of samples. Lasso regression remains a useful way to define a sparse fit in that setting, but its absolute-value penalty has a kink at zero. Proximal gradient handles that kink by taking a gradient step on the smooth squared-error loss and then applying a separate thresholding operation. The two parts of the update have distinct roles: the gradient responds to prediction error, while thresholding can set coefficients exactly to zero.

This tutorial derives that update for a fixed design matrix and shows how to calculate an iteration. It concerns the optimization step itself, not how to select the penalty strength or diagnose convergence of a complete numerical fit.

Objective and Assumptions

Let \(y\in\mathbb{R}^n\) be the response vector and \(X\in\mathbb{R}^{n\times p}\) the design matrix. The \(j\)th coefficient is \(\beta_j\), and \(\|\cdot\|_2\) denotes Euclidean norm. For a penalty strength \(\lambda\geq 0\), consider the lasso objective

$$ F(\beta)=f(\beta)+g(\beta) =\frac{1}{2n}\|y-X\beta\|_2^2+\lambda\|\beta\|_1, \qquad \|\beta\|_1=\sum_{j=1}^{p}|\beta_j|. $$

The factor \(1/(2n)\) fixes the scaling used below: it determines the gradient and the numerical meaning of \(\lambda\). Other conventions are possible, but their gradients and penalty values must be scaled consistently. We treat \(X\) and \(y\) as fixed finite data and optimize over \(\beta\). No probability distribution for the errors is required for this optimization derivation.

For clarity, the displayed objective has no intercept. If a model includes an unpenalized intercept, it must be handled separately: its squared-error gradient is updated without soft-thresholding. Any centering, scaling, or other preprocessing of predictors must be decided before fitting, since it changes the coefficient scale and the effect of a common penalty.

Definition: The proximal-gradient update for \(F=f+g\) first forms \(z=\beta^{(k)}-\eta\nabla f(\beta^{(k)})\), a gradient step on the differentiable part \(f\), and then sets \(\beta^{(k+1)}=\operatorname{prox}_{\eta g}(z)\). Here \(\eta>0\) is the step size, and \(\operatorname{prox}_{\eta g}(z)\) is the value \(u\) minimizing \(g(u)+\|u-z\|_2^2/(2\eta)\).

Deriving the Lasso Update

For the squared-error part, differentiating with respect to \(\beta\) gives

$$ \nabla f(\beta) =-\frac{1}{n}X^\mathsf{T}(y-X\beta) =\frac{1}{n}X^\mathsf{T}(X\beta-y). $$

Thus, from the current coefficient vector \(\beta^{(k)}\), the gradient step forms

$$ z=\beta^{(k)}-\eta\nabla f(\beta^{(k)}) =\beta^{(k)}+\frac{\eta}{n}X^\mathsf{T}(y-X\beta^{(k)}). $$

The remaining operation is the proximal map of \(g(\beta)=\lambda\|\beta\|_1\). Because the penalty and squared distance separate across coordinates, each coordinate minimizes \(\lambda|u|+(u-z_j)^2/(2\eta)\). For \(u>0\), the derivative is \(\lambda+(u-z_j)/\eta\), so a positive minimizer satisfies \(u=z_j-\eta\lambda\), which is positive only when \(z_j>\eta\lambda\). For \(u<0\), the derivative is \(-\lambda+(u-z_j)/\eta\), so a negative minimizer satisfies \(u=z_j+\eta\lambda\), which is negative only when \(z_j<-\eta\lambda\). When \(|z_j|\leq\eta\lambda\), neither nonzero candidate lies in its required region, and the minimum is at zero. These cases give the soft-thresholding operator

$$ S_t(a)=\operatorname{sign}(a)\max(|a|-t,0), \qquad \beta^{(k+1)}_j=S_{\eta\lambda}(z_j). $$

Applying this coordinate by coordinate yields the full update:

$$ \beta^{(k+1)} = S_{\eta\lambda}\!\left( \beta^{(k)}+\frac{\eta}{n}X^\mathsf{T}(y-X\beta^{(k)}) \right). $$

The threshold is \(\eta\lambda\), not just \(\lambda\): changing the step size changes how far the gradient step moves and how strongly the proximal operation thresholds that step. When \(\lambda>0\), the lasso penalty is nondifferentiable at coefficients equal to zero, so a plain gradient step on the whole objective is not defined there. When \(\lambda=0\), the penalty vanishes, the objective is differentiable everywhere, and this update reduces to an ordinary gradient step on squared error.

Worked Example: A One-Coordinate Proximal Map

Suppose one coordinate of the gradient-step vector is \(z=-0.7\), the step size is \(\eta=0.2\), and \(\lambda=1\). The threshold is \(\eta\lambda=0.2\), so

$$ S_{0.2}(-0.7) =\operatorname{sign}(-0.7)\max(0.7-0.2,0) =-0.5. $$

The minimization defining this proximal value is \(\min_u |u|+(u+0.7)^2/0.4\). At \(u=-0.5\), the objective is \(0.5+0.2^2/0.4=0.6\); at \(u=0\), it is \(0.7^2/0.4=1.225\). The thresholding result is therefore consistent with the defining minimization. The value is moved toward zero by \(0.2\), but it remains nonzero because the input magnitude exceeds the threshold.

Choosing a Step Size

A standard fixed step size is based on how rapidly the squared-error gradient can change. For any \(\beta,\gamma\),

$$ \|\nabla f(\beta)-\nabla f(\gamma)\|_2 = \left\|\frac{X^\mathsf{T}X}{n}(\beta-\gamma)\right\|_2 \leq L\|\beta-\gamma\|_2, \qquad L=\frac{\|X\|_2^2}{n}. $$

Here \(\|X\|_2\) is the largest singular value of \(X\), so \(L\) is the largest eigenvalue of \(X^\mathsf{T}X/n\). It is a Lipschitz constant for the gradient: the inequality states how much the gradient can change per unit change in the coefficient vector. For \(L>0\), the usual safe fixed-step condition is \(0<\eta\leq 1/L\). A smaller step may be used, but it changes the amount of progress per iteration. If \(X\) is the zero matrix, then \(L=0\) and the squared-error gradient is identically zero; the usual \(1/L\) formula does not apply.

The step-size condition is grounded in a quadratic upper bound. Since the squared-error loss has an \(L\)-Lipschitz gradient, for any \(u\) and current point \(x\),

$$ f(u)\leq f(x)+\nabla f(x)^\mathsf{T}(u-x) +\frac{L}{2}\|u-x\|_2^2. $$

When \(\eta\leq 1/L\), replacing \(L/2\) in this upper bound by \(1/(2\eta)\) gives a possibly looser upper bound. The proximal update minimizes that bound plus \(g(u)\), because completing the square in its \(u\)-dependent terms gives \(g(u)+\|u-(x-\eta\nabla f(x))\|_2^2/(2\eta)\). The minimized surrogate is no larger at the update than at \(u=x\). Consequently \(F\) does not increase in this exact-arithmetic step. This justifies the step-size restriction for the update; it does not mean that every larger step must fail, only that this guarantee no longer follows from the stated bound.

Worked Example: One Full Proximal-Gradient Iteration

Consider the hypothetical response \(y=(2,-1,1)^\mathsf{T}\) and design matrix

$$ X= \begin{pmatrix} 1&0\\ 0&1\\ 1&1 \end{pmatrix}. $$

Use the objective scaling above, \(\lambda=0.4\), and start from \(\beta^{(0)}=(0,0)^\mathsf{T}\). First, \(X^\mathsf{T}X/3\) has diagonal entries \(2/3\) and off-diagonal entries \(1/3\); its eigenvalues are \(1\) and \(1/3\). Thus \(L=1\), and \(\eta=1\) satisfies \(\eta\leq1/L\).

At the initial vector, the residual is \(y-X\beta^{(0)}=(2,-1,1)^\mathsf{T}\), and

$$ \frac{1}{3}X^\mathsf{T}(y-X\beta^{(0)}) = \frac{1}{3} \begin{pmatrix}3\\0\end{pmatrix} = \begin{pmatrix}1\\0\end{pmatrix}. $$

Therefore \(z=\beta^{(0)}+\eta X^\mathsf{T}(y-X\beta^{(0)})/3=(1,0)^\mathsf{T}\). The threshold is \(\eta\lambda=0.4\), giving

$$ \beta^{(1)} = \begin{pmatrix}S_{0.4}(1)\\S_{0.4}(0)\end{pmatrix} = \begin{pmatrix}0.6\\0\end{pmatrix}. $$

The second coefficient is zero because its gradient-step value does not exceed the threshold in magnitude. As a check on the arithmetic, the initial objective is \(F(\beta^{(0)})=(4+1+1)/6=1\). At \(\beta^{(1)}\), the fitted values are \((0.6,0,0.6)^\mathsf{T}\), so the residual sum of squares is \(1.4^2+(-1)^2+0.4^2=3.12\). Hence \(F(\beta^{(1)})=3.12/6+0.4(0.6)=0.76\), below the initial value.

More Predictors Than Samples

The update uses matrix-vector products, a spectral norm or eigenvalue for the step-size bound, and coordinatewise thresholding. It does not require inverting \(X^\mathsf{T}X\). Thus it is defined when \(p>n\), including cases where the design is rank deficient. Rank deficiency can mean multiple coefficient vectors minimize the lasso objective, but it does not prevent calculating a proximal-gradient step from a chosen starting vector.

Worked Example: A Step With Three Predictors and Two Samples

For a small hypothetical illustration of the \(p>n\) setting, take

$$ y=\begin{pmatrix}1\\1\end{pmatrix}, \qquad X= \begin{pmatrix} 1&0&1\\ 0&1&1 \end{pmatrix}, \qquad \beta^{(0)}=\begin{pmatrix}0\\0\\0\end{pmatrix}. $$

There are \(p=3\) predictors and \(n=2\) observations, and the third column is the sum of the first two. The matrix \(XX^\mathsf{T}/2\) is \(\begin{pmatrix}1&0.5\\0.5&1\end{pmatrix}\), whose eigenvalues are \(1.5\) and \(0.5\). The largest eigenvalue of \(X^\mathsf{T}X/2\) is also \(1.5\), so \(L=1.5\) and \(\eta=2/3\) is at the stated step-size bound.

At zero, \(X^\mathsf{T}y/2=(0.5,0.5,1)^\mathsf{T}\). The gradient-step vector is therefore \(z=(1/3,1/3,2/3)^\mathsf{T}\). With \(\lambda=0.4\), the threshold is \(\eta\lambda=4/15\), and the update is

$$ \beta^{(1)} = \begin{pmatrix} S_{4/15}(1/3)\\ S_{4/15}(1/3)\\ S_{4/15}(2/3) \end{pmatrix} = \begin{pmatrix} 1/15\\ 1/15\\ 2/5 \end{pmatrix} \approx \begin{pmatrix} 0.06667\\ 0.06667\\ 0.4000 \end{pmatrix}. $$

This calculation illustrates that the update is available despite \(p>n\) and dependent columns. It does not imply these coefficients are the unique minimizer; it shows only the result of one well-defined step from the stated starting vector.

Comparison, Diagnostics, and Limitations

ApproachHow the lasso penalty is handledPractical distinction
Proximal gradientGradient step on squared error, then soft-thresholding of all coordinatesUses a global step size and matrix-vector products; does not require coordinatewise minimization
Coordinate descentUpdates one coefficient at a time, minimizing with respect to that coordinate while holding others fixedCan exploit coordinate-level calculations; update order and repeated passes differ from a simultaneous proximal step
Plain gradient descent on the full objectiveWould require differentiating the entire objectiveWhen \(\lambda>0\), the absolute-value penalty is nondifferentiable at zero; proximal gradient handles this explicitly

These methods target the same penalized least-squares objective when implemented with consistent scaling, but their individual updates are not interchangeable. In particular, a proximal-gradient step thresholds the whole vector after a joint gradient move; a coordinate-descent update recalculates a single coordinate in relation to the others.

Several checks help identify a mis-specified step. Confirm that the residual in the gradient is \(y-X\beta^{(k)}\), that the factor \(1/n\) matches the chosen loss scaling, and that the threshold is \(\eta\lambda\). Check that the chosen step satisfies the bound based on the actual design matrix. If a predictor is rescaled, both the gradient geometry and the coefficient scale change; using an unchanged step-size calculation or interpreting coefficients as if the scale were unchanged can be misleading. These are checks on the update, not a substitute for assessing convergence of the full algorithm.

A common mistake is to say, “The lasso objective has no gradient, so gradient-based updates cannot be used.” The correction is that, for \(\lambda>0\), the whole objective is indeed nondifferentiable at zero, but its squared-error part has a well-defined gradient. Proximal gradient uses that smooth gradient and handles the penalty through its proximal operator. At \(\lambda=0\), there is no lasso penalty, so the objective is simply differentiable squared error.

Proximal gradient’s simplicity comes with limitations. A global step size is controlled by the largest design-matrix direction, which may make updates conservative in other directions. The method supplies iterates, not an automatic guarantee that a chosen finite number of iterations is sufficient. Also, with correlated or rank-deficient predictors, different coefficient vectors can have similar or identical fitted values; the mechanics of one update do not resolve that identifiability issue.

Check Your Understanding

Work through these questions, then compare with the solutions.

  1. For \(\eta=0.5\), \(\lambda=0.3\), and a gradient-step coordinate \(z=0.1\), what is the updated coordinate?
  2. For the loss \(\|y-X\beta\|_2^2/(2n)\), state its gradient and a valid fixed-step condition in terms of \(X\).
  3. Suppose \(L=4\). Is \(\eta=0.3\) within the standard fixed-step bound? What is the largest step allowed by that bound?
  4. Does \(p>n\) make the proximal-gradient update undefined? Explain why or why not.

Solutions. (1) The threshold is \(\eta\lambda=0.5(0.3)=0.15\), so \(S_{0.15}(0.1)=0\). (2) The gradient is \(\nabla f(\beta)=X^\mathsf{T}(X\beta-y)/n\), and with \(L=\|X\|_2^2/n>0\), a standard condition is \(0<\eta\leq1/L\). (3) The largest allowed step is \(1/4=0.25\); since \(0.3>0.25\), this step is outside the stated guarantee. (4) No. The update uses \(X^\mathsf{T}(y-X\beta)\) and coordinatewise thresholding rather than an inverse of \(X^\mathsf{T}X\), so it remains defined when \(p>n\), even if coefficients are not uniquely determined.

Clinical Biostats