Addaly is in open beta. Things will change, and AI answers can be wrong — check anything that matters.

When accuracy lies

Machine Learning, Foundations · lesson 6 of 9 · 9 min

The 99.8% model that does nothing

A payments company in Manila processes 100,000 transactions a day. About 200 are fraudulent.

Here is a model:

python
def predict(transaction):
    return "not fraud"

Accuracy: 99.8%. It catches nothing, has no parameters, and beats most first attempts on the headline number. Accuracy is the fraction of rows you got right, and when one class is 99.8% of the rows, that fraction is almost entirely a measurement of the class balance.

Rare events are where the money and the harm are. Fraud, disease, equipment failure, account takeover. Accuracy is close to useless for all of them.

Four cells, not one

A real model flags 400 transactions and catches 120 of the 200 frauds.

| | Actually fraud | Actually fine | |---|---|---| | Flagged | 120 (true positives) | 280 (false positives) | | Not flagged | 80 (false negatives) | 99,520 (true negatives) |

Everything you need is in that table.

Precision = 120 / 400 = 30%. Of what you flagged, this fraction was real. It is the analyst's experience: seven wasted reviews in every ten.

Recall = 120 / 200 = 60%. Of what was really there, this fraction was caught. It is the victim's experience: 80 frauds went through.

They answer different questions and they trade off. There is no way to read either from accuracy, which here is 99.6% and tells you nothing.

The threshold is yours, not the model's

Most classifiers do not output a class. They output a score between 0 and 1, and something turns that into a decision:

python
flag = model.predict_proba(x)[1] > 0.5

The 0.5 is a default someone typed. It is not a property of the model and it is rarely right for an imbalanced problem.

Drop it to 0.2 on the fraud model and you might flag 1,100 transactions, catching 170 of the 200. Recall rises from 60% to 85%. Precision falls from 30% to 15%, so analysts now review 1,100 cases instead of 400.

Nothing was retrained. One number changed. Before you conclude that a model needs to be bigger, move the threshold and look at what the trade actually costs.

Which error costs more

This is a business question with a numeric answer, and someone has to answer it.

  • Cancer screening. A missed tumour can be fatal; a false alarm means an uncomfortable follow-up scan. Favour recall, heavily.
  • Spam filtering. A spam message in the inbox is a mild annoyance; a job offer in the spam folder is a serious loss. Favour precision.
  • Card blocking. A missed fraud costs the issuer the disputed amount. A wrongly blocked card strands a customer abroad. Both are real, so put currency on each and pick the threshold that minimises expected cost.

Write the costs down before you look at a curve. Otherwise the threshold gets chosen by whichever number looked best in the notebook.

The summary metrics, honestly

F1 is the harmonic mean of precision and recall. It is popular, and it is usually the wrong summary, because it declares precision and recall equally important — which is exactly the judgement you should be making deliberately rather than inheriting from a formula.

ROC AUC is the probability that a random positive scores above a random negative. It is threshold-free and useful, but on heavily imbalanced data it flatters: the false-positive rate has 99,800 negatives in its denominator, so 280 false alarms barely register. A model can hold a ROC AUC of 0.95 and still be unusable in practice.

Precision-recall AUC uses precision instead, whose denominator is the flagged set. It shows the pain. On rare-event problems, prefer it.

Calibration is separate from all of these and often what you actually need. A calibrated model saying 0.7 is correct about 70% of the time. Ranking metrics ignore calibration entirely, so a model can rank perfectly and still be badly wrong about probabilities. If a downstream decision multiplies the score by an amount — expected loss, expected revenue — calibration is the property that matters, and you check it by bucketing predictions and comparing the predicted rate with the observed one.

Before you move on

A hospital triage model has 60% recall at its default threshold of 0.5. The clinical team needs to catch more cases. An engineer proposes retraining with a larger model on more data. What should be tried first?

Pick the one you would defend. Nobody sees your answer.

No ads. No data sale. No public scores on people. Ever.

© 2026 Addaly