homeprojectsblogcredentialsusesaboutcontact
blog/accuracy-misleading-metric
MLMetricsEvaluationClassification

Why Accuracy Is the Most Misleading Metric in Machine Learning

Accuracy is the first metric you learn - and the one most likely to lie to your face. A structured experiment across 6 classifiers and 7 regressors exposes exactly how far accuracy can mislead you.


In the world of Machine Learning, "Accuracy" is the celebrity metric. It is the first number beginners look at, the first number stakeholders ask for, and, almost always, the first number that lies straight to your face.

But here is the truth, and it is uncomfortable: Accuracy tells you how often a model is correct - not how it is correct.

This is not a theoretical concern. It is a practical trap that has sent real-world ML projects in entirely the wrong direction - from fraud detection systems that miss fraudulent transactions, to medical models that never actually learn to identify disease.

1. The Basics: What Accuracy Actually Measures

Accuracy is deceptively simple. It is just the ratio of correct predictions to total predictions.

Here is the critical flaw: Accuracy treats every mistake as equally important. A wrong prediction on a healthy patient and a wrong prediction on a critically ill patient are counted exactly the same.

In a perfectly balanced world where both classes appear equally, accuracy is a perfectly reasonable metric. But the real world is never perfectly balanced. Consider:

  • Fraud Detection - Only 0.1% of transactions may be fraudulent. A model that predicts "not fraud" for everything achieves 99.9% accuracy and catches zero fraudsters.
  • Medical Diagnosis - If 95% of patients are healthy, a model predicting "healthy" every time scores 95% accuracy and has never once diagnosed a disease.
  • Spam Filtering - A permissive model that lets everything through has excellent accuracy on legitimate email but fails completely at its actual job.

In each of these cases, a model can sit comfortably at high accuracy while completely failing to detect the minority class.

2. The Experiment: Building a Proper Test

A structured benchmarking experiment was conducted across two fundamentally different problem types - classification and regression - using real, publicly available datasets.

Datasets Used:

  • Adult Census Income Dataset (OpenML) - A classification task predicting whether an individual earns more than 50K per year. Naturally imbalanced - the majority earn below 50K.
  • California Housing Dataset - A regression task predicting median house prices based on geographic and socioeconomic features.

A clean, production-style pipeline was built using scikit-learn's Pipeline and ColumnTransformer - preventing data leakage, ensuring preprocessing fits only on training data, and making model comparisons genuinely fair.

A Stratified Train-Test Split (70/30) was used throughout, ensuring class proportions in both splits mirror the original dataset distribution.

3. Classification Results: The Accuracy Trap in Action

Six classifiers were benchmarked on the Census Income dataset:

  1. Logistic Regression
  2. Decision Tree Classifier
  3. Random Forest Classifier
  4. K-Nearest Neighbours
  5. Support Vector Classifier (SVC)
  6. AdaBoost Classifier

Each model was evaluated on four metrics: Accuracy, Precision, Recall, and F1-Score.

On the surface, the results looked remarkable. Models like SVC and Random Forest reported accuracy scores hovering around 86%. In a boardroom presentation, this is a success story.

But then you look at Recall. And the story falls apart.

Recall for SVC and Random Forest sat around 59%–61%. That means these models, despite their impressive accuracy, were failing to identify nearly 40% of high earners - the exact class the problem was built to detect.

This is the Accuracy Trap in its purest form. The models learned to be very good at identifying the majority class. They were mediocre, at best, at identifying the minority class. Accuracy masked this completely because the majority class dominated the score.

Why does this happen? Because predicting the majority class is the easiest path to high accuracy. The model does not need to learn anything subtle - it just needs to learn the dominant pattern. And when the dataset is imbalanced, that dominant pattern is simply "predict the majority class."

The F1-Score confirmed this - pulled down sharply by the low Recall, exposing the gap that accuracy concealed.

4. Regression Results: A Different Kind of Deception

The second half of the experiment shifted to the California Housing dataset. Seven regressors were benchmarked - including Random Forest, Gradient Boosting, SVR, and AdaBoost - evaluated on MSE, MAE, and R² Score.

In regression, the failure mode was different - but just as important.

Models with similar R² values produced very different MAE and RMSE values. R² measures how much variance in the target your model explains - a relative measure of fit. But it tells you nothing about the magnitude of your errors in practical terms.

RMSE, on the other hand, penalises large errors disproportionately. A model with a respectable R² could still produce dramatically large RMSE values if it was making occasional massive errors on high-value properties. In housing price prediction, that kind of error is not a statistical footnote - it is a real financial miscalculation.

Two models showed nearly identical R² scores while one had an RMSE twice as large as the other. If you stopped at R², you would never know.

5. What "Good Evaluation" Actually Means

For Classification:

  • Precision - Of all the samples your model flagged as positive, how many were actually positive?
  • Recall - Of all the actual positive cases, how many did your model correctly catch? This is the metric that matters most in medical diagnosis, fraud detection, and safety-critical applications.
  • F1-Score - The harmonic mean of Precision and Recall. A model cannot game F1 by sacrificing one for the other.
  • Confusion Matrix - The complete breakdown of TP, TN, FP, FN. Does not aggregate - shows you exactly where the model is failing.

For Regression:

  • MAE - The average magnitude of errors, in the same units as the target. Interpretable, robust to outliers.
  • RMSE - Penalises large errors more heavily. Critical when big mistakes are disproportionately costly.
  • - Useful as a relative measure of fit, but never sufficient alone. Always pair with error magnitude metrics.

6. The Real Takeaway

This experiment reinforces a fundamental law of ML evaluation: The metric is the lens. Choosing the wrong lens blinds you.

You can spend weeks building a sophisticated pipeline, tune your hyperparameters carefully, achieve state-of-the-art accuracy - and still walk away with completely the wrong conclusion, simply because you only looked at one number.

Here is what this experiment proved, concretely:

  • Models with 86% accuracy were missing 4 in 10 high-income individuals.
  • Models with similar R² scores had wildly different real-world error magnitudes.
  • Accuracy remained stable and optimistic while Recall and F1-Score exposed systematic failure.
  • A simple algorithm evaluated well will always outperform a complex algorithm evaluated poorly.

The model is not the problem. The evaluation is.

7. So How Do You Stay Honest?

There are 7 battle-tested practices that prevent the accuracy trap entirely - from how you define your critical metric *before* training begins, to why the confusion matrix should be the last thing you look at before making any decision.

One of them catches a leakage error so subtle that most practitioners have already made it and never noticed. Another is a visualization trick that makes metric disagreement impossible to ignore...

Which metric shift had the most impact on how you evaluated your own models?

See the full 7 practices, the complete result tables, and the GitHub repo → namespace.world ↗