Regression Metrics (MAE, MSE, RMSE, R², MAPE)
Pick regression metrics that match business cost of errors and scale sensitivity.
In plain words
These numbers tell you how far off a model's predictions are, in different ways: average miss, extra penalty for big misses, how much it explains and the miss as a percentage.
Think of it like…
Measuring how far off your guesses are: average miss in metres (MAE), a penalty that grows rapidly for big misses (RMSE), the share of the spread you captured (R²) or the miss as a percentage of the target (MAPE): they answer different questions about the same errors.
Where you’ve seen it
Actual values are 100, 200, 300, 400 and predictions 110, 190, 330, 380, so the errors are 10, −10, 30, −20. MAE = (10 + 10 + 30 + 20)/4 = 17.5. MSE = (100 + 100 + 900 + 400)/4 = 375 and RMSE = 19.36. MAPE = (10% + 5% + 10% + 5%)/4 = 7.5%, and WAPE = Σ|e| / Σy = 70/1,000 = 7.0%. With ȳ = 250, SST = 150² + 50² + 50² + 150² = 50,000 and SSE = 1,500, so R² = 1 − 1,500/50,000 = 0.97. If one error becomes 100 instead of 30 (errors 10, −10, 100, −20), MAE rises to 35 but RMSE jumps to √2,650 = 51.5, showing RMSE's sensitivity to large misses. MAPE's asymmetry: predicting 150 for an actual 100 is +50%, while predicting 100 for an actual 150 is −33.3%, so over-forecasts are penalised more than under-forecasts. For a retailer whose stockouts cost 3 times as much as overstock, the team trains with a quantile (pinball) loss at the 0.75 quantile and reports MAE alongside the asymmetric cost, not RMSE alone.
Words you’ll hear
- MAE / RMSE
- Average absolute error versus the root of average squared error; RMSE punishes large errors.
- R²
- Share of variance explained relative to a mean-only baseline; can be negative.
- MAPE / WAPE
- Percentage error per row versus total absolute error over total actuals.
- Pinball (quantile) loss
- An asymmetric loss used when over- and under-prediction cost differently.
Visual diagram
Theory & deep dive
The metrics and how to compute them
With errors eᵢ = yᵢ − ŷᵢ: MAE = (1/n) Σ|eᵢ|; MSE = (1/n) Σeᵢ²; RMSE = √MSE. MAE is the optimal-loss metric for the median and is robust; MSE/RMSE correspond to the mean and penalise large errors quadratically, which is desirable when big misses are disproportionately costly (a 100-unit miss counts as much as 100 misses of 10 in squared terms) but makes the metric sensitive to outliers (RMSE 19.36 becomes 51.5 when one error grows from 30 to 100, while MAE only doubles from 17.5 to 35). R² = 1 − SSE/SST compares the model to always predicting ȳ: 1 is perfect, 0 equals the mean-only baseline and negative values are worse than the baseline (possible out of sample). Adjusted R² penalises extra features in-sample.
Percentage metrics: MAPE = (100/n) Σ|eᵢ/yᵢ| is scale-free and easy to explain, but undefined when yᵢ = 0, explodes for small actuals and is asymmetric (over-forecasts can be unboundedly large percentages while under-forecasts are capped at 100%). sMAPE and WAPE (Σ|e|/Σ|y|, a volume-weighted percentage: 70/1,000 = 7.0%) behave better. RMSLE (RMSE of log(1 + y) vs log(1 + ŷ)) measures relative error and penalises under-prediction more than over-prediction. Median absolute error is robust to outliers. MASE divides MAE by the MAE of a naive forecast, giving a baseline-relative score (below 1 beats the naive).
y = 100, 200, 300, 400; ŷ = 110, 190, 330, 380. MAE = 70/4 = 17.5. MSE = 1,500/4 = 375, RMSE = 19.36. MAPE = (0.10 + 0.05 + 0.10 + 0.05)/4 = 7.5%. SST = 50,000, SSE = 1,500, R² = 0.97.
Choosing a metric and aligning the loss
Start from cost: if every unit of error costs the same (inventory dollars), use MAE; if large errors are disproportionately damaging (safety margins, SLAs), use RMSE; if errors matter proportionally across scales (prices spanning orders of magnitude), use a relative metric (WAPE, RMSLE, MAPE with care); if over- and under-prediction cost differently, use an asymmetric loss such as quantile/pinball loss (for a 3:1 stockout-to-overstock cost ratio the optimal forecast is the 75th percentile: 3/(3 + 1)) and evaluate with the same cost function. Report more than one metric (MAE and RMSE together reveal outlier influence: a large RMSE/MAE ratio signals heavy-tailed errors) and always compare with a baseline (mean, last value, seasonal naive).
Align training and evaluation: the loss you optimise should reflect the metric you care about (squared-error training estimates the mean, absolute-error training the median, pinball loss a quantile), and when you transform the target (log) you must evaluate errors in original units after back-transforming. Slice metrics by segment (region, price band, new versus existing) since a single aggregate hides where the model fails. Use cross-validation to get a mean and spread, prediction intervals where decisions need uncertainty and be careful with R² on non-stationary or trending data (it can be high just because the target trends). For stakeholders, translate: "typical error is $17.50, with occasional misses up to $30" is clearer than "RMSE 19.36".
Stockout costs $30 per unit missed; overstock costs $10 per unit extra. The cost-minimising forecast is the 30/(30 + 10) = 0.75 quantile of demand. Evaluate with the pinball loss at 0.75 and the dollar cost, not just RMSE.
How it works, step by step
Step 1 of 41. Define the cost of errors
Decide whether errors are symmetric, relative or asymmetric and whether large misses are especially costly.
- Translate
- to dollars
When to use it & trade-offs
What it is
Regression metrics summarise prediction error in a single number, and each encodes a different view of cost. MAE (mean absolute error) averages |y − ŷ| in the target's units and treats all errors proportionally; MSE averages squared errors and RMSE is its square root (also in target units), penalising large errors more heavily; R² = 1 − SSE/SST reports the share of variance explained relative to predicting the mean; MAPE averages |y − ŷ|/|y| as a percentage, which is scale-free but breaks at zeros and is asymmetric. Others include median absolute error (robust), RMSLE (relative errors on a log scale), WAPE and MASE (scaled against a naive forecast). The right metric is the one that matches the business cost of errors.
Why it matters: A model can look good on one metric and bad on another: RMSE may be dominated by a few large misses while MAE barely moves; R² can be high for a model that is useless in dollars; MAPE can explode on near-zero actuals. Choosing and reporting the metric that reflects how errors cost money (a symmetric dollar loss, an asymmetric stockout versus overstock, a relative error across scales) is part of problem framing, not an afterthought, and it determines the loss you should train against.
When to reach for it
- Choosing evaluation and training objectives
- Reporting model quality to stakeholders
- Comparing models against baselines
When to avoid or be careful
- MAPE on data with zeros or near zeros
- Reporting only R² as evidence of usefulness
- Scoring log-target models on the log scale only
Regression metrics
Strengths: Same units; robust to outliers.
Watch out: Doesn't punish large misses extra.
Strengths: Differentiable; emphasises big misses.
Watch out: Sensitive to outliers.
Strengths: Scale-free and easy to communicate.
Watch out: MAPE fails at zero and is asymmetric.
Interview signals & numbers to know
When this topic comes up
- “Which metric should we optimise?”
- MAE vs RMSE
- Negative R²
- Asymmetric cost of errors
- Quantile regression
Benchmarks & rules of thumb
- 17.5 / 19.36 / 0.97
- MAE, RMSE and R² in the worked example
- 35 vs 51.5
- MAE and RMSE after one error grows to 100
- τ = C_under/(C_under + C_over)
- optimal quantile for asymmetric costs
Common mistakes & follow-ups
Common interview mistakes
- Choosing RMSE by habit when the business cost is linear.
- Comparing MAPE across series with very different scales without care.
- Believing a high R² means accurate predictions in dollars.
Likely interviewer follow-ups
- When would you prefer MAE over RMSE?
- Why is MAPE problematic?
- How would you handle asymmetric costs of over- and under-prediction?
Knowledge check
Put it into practice
Practice related interview Q&A
Apply Regression Metrics (MAE, MSE, RMSE, R², MAPE) with data science interview Q&A and hands-on practice.