Ridge Regression
You just learned about lasso regression, which introduces a penalty and tries to eliminate certain features from the data. Ridge regression takes an alternative approach by introducing a penalty that penalizes large weights. As a result, the optimization process tries to reduce the magnitude of the coefficients without completely eliminating them.
Exercise 7.10: Fixing Model Overfitting Using Ridge Regression
The goal of this exercise is to teach you how to identify when your model starts overfitting, and to use ridge regression to fix overfitting in your model.
Note
You will be using the same dataset as in Exercise 7.09, Fixing Model Overfitting Using Lasso Regression.
The following steps will help you complete the exercise:
- Open a Colab notebook.
- Import the required libraries:
import pandas as pd from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression, Ridge from sklearn.metrics import mean_squared_error...