Ridge regularization
In the last exercise you practiced performing lasso regularization. If you're asked about regularization techniques in a machine learning interview, know what differentiates the 2 norms. Lasso uses the L1 norm corresponding to the penalty parameter and the absolute value of the coefficients. Ridge regression performs L2 regularization, also known as L2-norm, which adds a penalty term to ordinary least squares using the penalty parameter and the sum of the squared coefficients.
For this exercise, you'll practice regularization with Ridge on the diabetes
DataFrame. The feature matrix and target array are saved to your workspace as X
and y
, respectively.
Already imported for you are mean_squared_error
from sklearn.metrics
and train_test_split
from sklearn.model_selection
.
Cet exercice fait partie du cours
Practicing Machine Learning Interview Questions in Python
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Import modules
from sklearn.____ import ____
from sklearn.____ import ____