I'm using LASSO regression from Sklearn, and I wanted to see if it is possible to calculate the coefficients and predictions by hand? Currently I'm just fitting the model and then using the predict function. I haven't been able to find any sources going over the algorithm behind LASSO predictions, and would just like to see how it works in a basic case.

  • 2
    $\begingroup$ The prediction function for a LASSO model is exactly the same as a linear regression, it's only the fitting algorithm that is modified. $\endgroup$ – Matthew Drury Aug 12 '19 at 18:26
  • 2
    $\begingroup$ Regarding the coefficients, there's a closed form in the case of a full rank and orthogonal design matrix, but in general you can only compute it by hand if you're feeling up for running through a numerical optimization by hand. This is just like with computing a logistic regression by hand, where except for a few special cases you'll need to do matrix multiplications and inversions by hand which will probably be neither insightful nor fun $\endgroup$ – jld Aug 12 '19 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.