Polynomial Regression on Auto MPG Dataset with Comparison to Linear Regression
Experiment Title
Polynomial Regression on Auto MPG Dataset with Comparison to Linear Regression
🎯 Aim
To implement Polynomial Regression on the Auto MPG dataset to predict MPG using engine displacement, and compare it with Linear Regression using MSE and R².
Objectives
-
Load and preprocess dataset
-
Implement Linear Regression
-
Implement Polynomial Regression (multiple degrees)
-
Compare models using MSE and R²
-
Visualize regression curves
🛠️ Tools Required
-
Python
-
NumPy
-
Pandas
-
Matplotlib
-
Scikit-learn
-
Seaborn
📖 Theory
🔹 Linear Regression
Fits a straight-line relationship between input and output.
🔹 Polynomial Regression
Extends linear regression by adding higher-degree terms to model non-linear relationships.
🔹 Evaluation Metrics
-
MSE → Lower is better
-
R² → Closer to 1 is better
📋 Procedure
-
Load dataset
-
Handle missing values
-
Select feature (
displacement) and target (mpg) -
Split dataset
-
Train linear model
-
Train polynomial models (degree 2, 3, 5)
-
Evaluate using MSE and R²
-
Plot regression curves
💻 Program (Error-Free Version)
📊 Output
-
MSE and R² for:
-
Linear Regression
-
Polynomial Regression (degree 2, 3, 5)
-
-
Smooth plot showing:
-
Linear fit
-
Polynomial curves
📈 Interpretation
-
Linear model → may underfit
-
Degree 2 or 3 → usually best balance
-
Higher degree (5) → may overfit
Result
Polynomial regression models were successfully implemented and compared with linear regression using MSE and R² without any warnings or errors.
Polynomial regression improves modeling of nonlinear relationships
-
Proper data handling avoids warnings
-
Model selection depends on performance metrics

Comments
Post a Comment