Catching fraud and anomalies with machine learning
Rules catch the fraud you've already seen. Anomaly detection catches the fraud you haven't. The best systems use both.
Fraud detection has a fundamental problem: fraudsters adapt. The moment you write a rule to catch a known fraud pattern, the people committing it learn the rule and route around it. Rules are essential, they catch the known patterns cheaply and explainably, but a system built only on rules is always fighting the last war.
Machine learning anomaly detection attacks the problem from the other side. Instead of encoding what fraud looks like, it learns what *normal* looks like and flags what deviates. That lets it surface patterns nobody has written a rule for yet, including the ones fraudsters invent tomorrow.
Rules vs. models: use both
The mistake is treating this as a choice. The strongest fraud systems layer the two:
- Rules handle the known, clear-cut cases. They're fast, cheap, explainable, and auditable, which matters enormously in regulated environments where you must justify why a transaction was blocked.
- Models handle the unknown and the subtle. Anomaly detection catches combinations of signals no human would think to encode, and adapts as behaviour shifts.
Rules give you precision on what you understand; models give you coverage on what you don't. Together they cover far more ground than either alone.
How anomaly detection works, briefly
The core idea is to build a model of normal behaviour, per customer, per account, per transaction type, and measure how far each new event sits from that normal. A transaction that's unremarkable in isolation can be highly anomalous in context: a normal amount, but at an unusual time, from an unusual location, in an unusual sequence. Models are good at spotting these multi-dimensional oddities that are invisible when you look at any single field.
Some approaches learn from labelled fraud examples (supervised); others learn only from normal behaviour and flag deviations (unsupervised). In practice fraud data is imbalanced, there's far more legitimate activity than fraud, which shapes which techniques work and how you measure them.
The false-positive problem is the real problem
Here's the trap. It's easy to build a model that catches more fraud by flagging more transactions. The cost of that is false positives, legitimate activity wrongly flagged, and false positives are expensive in two ways: they annoy real customers whose transactions get blocked, and they bury your investigation team under alerts they can't possibly work through.
A fraud system that cries wolf gets ignored, exactly like a flaky test suite. The real engineering challenge isn't catching more fraud; it's catching more fraud *without* drowning investigators in noise. That means tuning the trade-off deliberately, measuring precision and recall honestly, and ranking alerts so the highest-risk ones surface first.
Measuring it honestly
Accuracy is a misleading metric for fraud, because if 99.9% of transactions are legitimate, a model that flags nothing is 99.9% accurate and completely useless. The honest measures are precision (of what you flagged, how much was really fraud) and recall (of the real fraud, how much you caught), and the balance between them that fits your risk appetite and your investigation capacity.
This is the evidence-first discipline again: don't take the model's word that it's catching fraud. Measure precision and recall on held-out data, and measure the investigator workload the chosen threshold produces. Both numbers matter.
Deploying it responsibly
Fraud and anomaly detection sits in a high-stakes, often regulated context, so a few principles are non-negotiable:
- Keep a human in the loop for actions with real consequences. A model flags; a person decides on the significant cases.
- Preserve explainability where regulation requires it. If you must justify a decision, you need a system that can.
- Monitor for drift. Fraud patterns and normal behaviour both change. A model that isn't monitored and retrained silently degrades.
Start, as always, by framing the real question and assessing whether your data can support it. Fraud detection is one of the clearest cases where machine learning earns its place, provided it's built to augment investigators rather than bury them, and measured honestly rather than by a flattering accuracy number.
Key takeaways
- →Rules catch known fraud cheaply and explainably; ML anomaly detection catches the unknown by learning normal and flagging deviation. Use both.
- →Anomaly detection spots multi-dimensional oddities (normal amount, unusual time/location/sequence) invisible in any single field.
- →The hard problem is false positives: catching more fraud by flagging more transactions buries investigators and blocks real customers.
- →Measure precision and recall, not accuracy (99.9% accurate can mean useless), keep humans in the loop, preserve explainability, and monitor for drift.
Sources & further reading
- 1.Nullius Technologies, anomaly and fraud detection prototyping
Related service
Data Science & Machine Learning
Turn data you already have into models, forecasts, and dashboards that drive decisions.