Ridge regression

The equation for ridge regression is as follows:

In the preceding equation, the ridge loss function is equal to the ordinary least squares loss function, plus the product of the square of Parameter1 of each feature and alpha.

alpha is a parameter that we can optimize in order to control the amount by which the ridge loss function penalizes the coefficients, in order to prevent overfitting. Obviously, if alpha is equal to 0, the ridge loss function is equal to the ordinary least squares loss function, thereby making no difference to the initial overfit model.

Therefore, optimizing this value of alpha provides the optimal ...

Get Machine Learning with scikit-learn Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.