In this section, we will look at the basic concept of LASSO regression, including the hyperparameters that it introduces and how to use it in practice.
Put simply, LASSO regression is another method for regularizing a linear model while fitting—more so than OLS. LASSO is extremely similar to ridge regression in form, but the penalty terms are different. In many ways, the two procedures are interchangeable, but they don't necessarily get the same solutions, so you might want to consider looking at both. LASSO regression has the same alpha parameter as ridge regression, and it is used the same way. A larger alpha value penalizes overfitting. So, let's take a look at LASSO in action:
- We will import the Lasso object along with the other required libraries, as follows:
- We will then fit a LASSO regression model, choosing alpha=1 again, using the...