Metrics & Evaluation

MSE, MAE, RMSE, R²

Evaluating continuous numeric predictions using Mean Squared Error, Mean Absolute Error, Root Mean Squared Error, and R-squared.

🟢 beginner5 min readmetrics
Regression Metrics evaluate continuous numeric prediction models. Mean Absolute Error (MAE) measures average error magnitude robustly against outliers. Mean Squared Error (MSE) and Root Mean Squared Error (RMSE) penalize large prediction errors heavily due to squaring. R-squared (Coefficient of Determination) measures the proportion of target variance explained by the model compared to a simple mean baseline.

Evaluating Continuous Numeric Predictions

Unlike classification (where predictions are discrete classes), Regression Models predict continuous numbers (for example house prices, delivery times, stock values).

Evaluating continuous predictions requires measuring the magnitude of error residuals:

$$\text{Residual } e_i = y_i - \hat{y}_i$$

┌──────────────────────────┬──────────────────────────┬──────────────────────────┬──────────────────────────┐
│ 1. MAE (Abs Error)       │ 2. MSE (Squared Error)   │ 3. RMSE (Root Squared)   │ 4. R-SQUARED (Variance)  │
├──────────────────────────┼──────────────────────────┼──────────────────────────┼──────────────────────────┤
│ Linear mean error.       │ Quadratic mean error.    │ Square root of MSE.      │ Fraction of target       │
│ Robust to outliers!      │ Heavily penalizes large  │ Same units as target,    │ variance explained by    │
│                          │ outlier errors!          │ penalizes outliers!      │ the model (0 to 1).      │
└──────────────────────────┴──────────────────────────┴──────────────────────────┘

1. Mean Absolute Error (MAE)

$$\text{MAE} = \frac{1}{N} \sum_{i=1}^N |y_i - \hat{y}_i|$$

2. Mean Squared Error (MSE) and Root Mean Squared Error (RMSE)

$$\text{MSE} = \frac{1}{N} \sum_{i=1}^N (y_i - \hat{y}_i)^2, \quad \text{RMSE} = \sqrt{\text{MSE}}$$

3. R-squared ($R^2$ Coefficient of Determination)

$$R^2 = 1 - \frac{\sum (y_i - \hat{y}i)^2}{\sum (y_i - \bar{y})^2} = 1 - \frac{\text{SS}{\text{res}}}{\text{SS}_{\text{tot}}}$$

Summary Metric Selection Guide

Business GoalRecommended Metric
Interpretability & Outlier ResilienceMAE
Strictly Penalizing Large Outlier ErrorsRMSE
Measuring Explanatory Power Against BaselineR-squared

Say this out loud

Regression metrics evaluate continuous numeric predictions. MAE measures average absolute error linearly and is robust against outliers. MSE and RMSE square errors, penalizing large prediction deviations heavily. RMSE returns error values to the original target units. R-squared measures the proportion of target variance explained by model features.

Followups to expect

  1. Can R-squared be negative? Yes, R-squared becomes negative if the trained model performs worse than a simple horizontal line predicting the mean target value everywhere on held out test data.
  2. What is Huber Loss? A loss function combining MAE and MSE: behaving like MSE for small errors and switching to MAE for large errors, balancing smoothness with outlier robustness.

Check yourself

Question 1 of 3

Why does Mean Squared Error (MSE) penalize large prediction errors far more heavily than Mean Absolute Error (MAE)?

More in Metrics & Evaluation

See all →
Precision, Recall & F14 minWhy Accuracy Lies4 minROC-AUC vs PR-AUC4 min