Classification has accuracy, precision and recall, but regression has its own set of scores, and they answer different questions. Picking the wrong one can make a bad model look good, or hide the kind of error that matters for your problem.
Mean absolute error (MAE)
MAE is the average of the absolute differences between predictions and actual values. It is in the same units as your target, so an MAE of 4.2 on a delivery-time model means predictions are off by 4.2 minutes on average. It treats every error in proportion to its size, which makes it easy to explain and relatively unaffected by a few extreme misses.
Root mean squared error (RMSE)
RMSE squares each error, averages the squares, then takes the square root. Squaring means large errors count much more than small ones, so RMSE is larger than MAE whenever errors vary in size. It is also in the target’s units. Choose RMSE when big misses are disproportionately costly, and MAE when every unit of error costs about the same.
R-squared
R-squared, or the coefficient of determination, compares your model’s errors to those of a model that always predicts the mean. A value of 1 means perfect predictions, and 0 means no better than predicting the mean. On held-out data it can be negative, which means the model is worse than that simple guess. It is unitless, so it is useful for comparing models on one dataset, but it does not tell you how large the errors are in practice.
Computing them in scikit-learn
from sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score
mae = mean_absolute_error(y_true, y_pred)
rmse = mean_squared_error(y_true, y_pred) ** 0.5
r2 = r2_score(y_true, y_pred)
Here y_true and y_pred are the actual and predicted values from your held-out set. Taking the square root of the mean squared error gives RMSE and works across library versions.
Percentage errors and their trap
Mean absolute percentage error, or MAPE, expresses error relative to the actual value, which is easy to communicate. It breaks when actual values are zero or very close to zero, because the percentage becomes infinite or huge, and it penalizes over-predictions and under-predictions unevenly. For demand data with many zeros, as in time series forecasting baselines, MAE or a scaled error is usually safer.
How outliers change the picture
A few extreme errors can dominate RMSE while barely moving MAE. If your RMSE is much larger than your MAE, look at the biggest errors before trusting either number, and decide whether those points are real or data problems, as discussed in outlier detection methods.
Always compare with a baseline
A score means little alone. An MAE of 4.2 is impressive if predicting the average gives 9, and unimpressive if it gives 4.5. Compute the same metric for a simple baseline model and report the improvement. Measure on data the model has not seen, using the approach in cross-validation for small datasets, since training error flatters every model, a point tied to the bias-variance trade-off.
Choosing a metric
- Use MAE when you want a plain, explainable average error and big misses are not special.
- Use RMSE when large errors are especially costly.
- Use R-squared to compare models on the same data, alongside an error in real units.
- Use MAPE only when actual values are safely away from zero.
A quick checklist
- Are you scoring on held-out data, not training data?
- Does the metric match the real cost of different kinds of error?
- Do you report an error in the target’s units, not just R-squared?
- Did you compare against a simple baseline?
- Did you check whether a few large errors drive the result?
If you want help choosing evaluation metrics and building a reliable regression model, see my machine learning and MLOps service.
FAQ
What is the difference between MAE and RMSE?
MAE averages the absolute errors, so every unit of error counts equally. RMSE squares errors first, so large errors weigh more. RMSE is never smaller than MAE.
Can R-squared be negative?
Yes, on held-out data. A negative value means the model predicts worse than simply using the mean of the target.
Which regression metric should I use?
It depends on how costly errors are. MAE suits plain average error, RMSE suits cases where large misses are especially bad, and R-squared helps compare models alongside an error in real units.

