IniziaInizia gratis

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.

Machine learning pipeline

Questo esercizio fa parte del corso

Practicing Machine Learning Interview Questions in Python

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Import modules
from sklearn.____ import ____
from sklearn.____ import ____
Modifica ed esegui il codice