← Back to all experiments
RegressionIntermediateLinear RegressionPolynomial Regression

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

Code snapshot

Key lines that anchor the experiment workflow.

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.