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