Coordinate Descent
The full LASSO problem couples the coefficients through the fitted values. Coordinate descent makes that problem manageable by optimizing one coefficient exactly while keeping the others fixed, then repeating the cycle.
Isolating one coefficient¶
Use the half sum objective defined in Sparse Regression and Trees. For coordinate , define a partial residual that omits its current contribution:
Only the following part of the objective depends on the replacement value :
Set and . Expanding the square gives
Assume . A zero column contains no predictive information and can be removed.
Deriving the update¶
If , differentiation gives . The solution is positive only when .
If , the derivative is . The solution is negative only when .
At , the subgradient contains zero precisely when . Combining the cases,
If the column has squared norm one, the denominator disappears. Centering alone does not make this true. Scaling to empirical variance one commonly gives a squared column norm of or , depending on the convention.
Updating with the full residual¶
Maintaining avoids rebuilding the partial sum. Since ,
For example, with , , and , the update is . With the same and but , the update is zero. These are coordinate calculations with the other coefficients held fixed, not complete model fits.
Active sets and optimality checks¶
The active set is . Once a sparse candidate model is found, many iterations can concentrate on these coordinates. But a predictor outside the active set can become useful after the residual changes.
At convergence, check every coordinate against the optimality conditions. For inactive variables, must hold. For active variables, the residual correlation must match times the coefficient sign, within numerical tolerance.
A screening rule can temporarily omit variables, but its guarantees matter. Some rules require a later check that restores excluded variables if they violate optimality. Keeping only the first active set forever is not a valid general algorithm.
What may be precomputed¶
The identity
connects the updates to feature inner products. Precomputing them can help when the design is moderate in size. Storing the entire Gram matrix costs on the order of entries, which can be impractical for very large . Residual updates and sparse matrix operations avoid that requirement.
Computation is reduced by sparsity, warm starts, and efficient checks, but it does not become completely independent of the original number of predictors. The data must still be read, and omitted variables must be screened or checked correctly.