Lesson 7.4: Evaluation Metrics for Regression (MAE, MSE, R²)
🔹 Why Evaluate Regression Models?
Regression models predict continuous values, so we need metrics to measure how close predictions are to actual values.
🔹 Common Metrics
-
Mean Absolute Error (MAE)
-
Measures average absolute difference between predicted and actual values.
-
Formula:
MAE=1n∑i=1n∣yi−y^i∣MAE = \frac{1}{n} \sum_{i=1}^{n} |y_i – \hat{y}_i|
-
Interpretation: Lower MAE → Better predictions.
-
Mean Squared Error (MSE)
-
Measures average squared difference between predicted and actual values.
-
Formula:
MSE=1n∑i=1n(yi−y^i)2MSE = \frac{1}{n} \sum_{i=1}^{n} (y_i – \hat{y}_i)^2
-
Interpretation: Penalizes large errors more than MAE.
-
Root Mean Squared Error (RMSE)
-
Square root of MSE.
-
Same units as target variable.
-
Formula:
RMSE=MSERMSE = \sqrt{MSE}
-
R² Score (Coefficient of Determination)
-
Measures proportion of variance explained by the model.
-
Formula:
R2=1−SSresSStotR^2 = 1 – \frac{SS_{res}}{SS_{tot}}
-
Range: 0 to 1 (closer to 1 → better model)
🔹 Quick Recap
-
MAE → Average absolute errors
-
MSE/RMSE → Penalize large errors
-
R² → How well model explains variance
