There are also ways to limit the influence of coefficients on the regression output. These methods are called regularization methods, and two of the most common regularization methods are lasso and ridge regression. We cover how to implement both of these in this recipe.
Implementing lasso and ridge regression
Getting ready
Lasso and ridge regression are very similar to regular linear regression, except we add regularization terms to limit the slopes (or partial slopes) in the formula. There may be multiple reasons for this, but a common one is that we wish to restrict the features that have an impact on the dependent variable. This can be accomplished by adding a term to the loss function that depends on the value of our...