← Back to all experiments
RegressionIntermediateLinear RegressionPolynomial Regression

EXP7: Linear vs Polynomial Regression

Compares linear and polynomial regression on housing and auto MPG data.

Key highlights

  • Evaluates MSE and R2
  • Visualizes predicted vs actual
  • Fits polynomial curve on horsepower

Metrics

MSER2

Dataset

Boston Housing + Auto MPG

Outputs

Linear regression scatter
Predicted vs actual for Boston Housing
Polynomial regression curve
Degree-4 polynomial fit for MPG

Full Python Code

The complete Python script directly from the repository.

Python
linear_reg.fit(X_train, y_train)
y_pred = linear_reg.predict(X_test)
print(f"Linear Regression - MSE: {mse}")

Next steps

Want to explore further? Try the full gallery or open the raw script to tweak parameters.