1
$\begingroup$

I am trying to implement the LASSO regression from scratch to better understand it. For now I just follow the pseudocode from here (page 5) for forward stagewise. It goes like this:

  1. Init with $r=r-\bar y$, $\beta_i = 0$
  2. Find the predictor $x_j$ most correlated with $r$.
  3. Update $beta_j \leftarrow \beta_j + \delta_j$, where $\delta_j = \epsilon \cdot sign(corr(r, x_j))$
  4. Update $r \leftarrow r - \delta_j x_j$
  5. Repeat 2–4 until no predictor correlates with $r$.

Where should regularization parameter appear in this? When defining LASSO, we want $\sum\beta_i\le C$, but I don't see at which point of the algorithm we regularize. Am I confusing something?

Also, is it possible to not fit intercept with this algorithm? Usually we add a column $x_0$ with constants for that, but with this algorithm it will always produce the correlation of 0. So is the data normalization (i.e., bring all means to 0) the only way?

$\endgroup$

1 Answer 1

2
$\begingroup$

At each iteration, the solution is optimal (in a sense) for that particular value of $\Sigma |\beta|=C$. The algorithm produces a path that gives solutions for various values of $C$. Note that the path this algorithm produces is somewhat different than the LASSO path.

Regarding the second question, there is nothing stopping one from initializing with $r=y$ and including an intercept as a predictor (or not). In general, it just doesn't usually make sense to regularize the intercept term (or make an analysis that isn't invariant to shifts in $y$).

$\endgroup$
4
  • $\begingroup$ Maybe I am just missing something, but I thought that LASSO is the type of regression and "forward stagewise" is an algorithm for performing it. Also, I am still not sure at what step and how you should enforce the constraints. $\endgroup$
    – Physmatik
    Commented Dec 2, 2020 at 21:33
  • $\begingroup$ As it states in the paper, this algorithm doesn't yield LASSO solution paths, but the way you enforce the constraint is by continuing M steps until M*epsilon = C. $\endgroup$
    – HStamper
    Commented Dec 2, 2020 at 22:13
  • $\begingroup$ Okay, thank you. Probably last question: I often see the regularization discussed in terms of $\lambda$ (by defining extra term $\lambda \sum |\beta|$ in loss function). Is it okay to think about this in terms of $\lambda = \frac{1}{C}$? I.e., can we compare 1/C to $\lambda$ in ridge regression that has closed form solution expressed in terms of $\lambda$? $\endgroup$
    – Physmatik
    Commented Dec 2, 2020 at 23:00
  • $\begingroup$ Yes. You'll want to be careful with the comparison to ridge when using software because I've see LASSO often parameterized in terms of $C^*=C/\Sigma|\hat{\beta}_{OLS}$. See for example the predict.lars documentation here: cran.r-project.org/web/packages/lars/lars.pdf $\endgroup$
    – HStamper
    Commented Dec 4, 2020 at 0:24

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.