15 August 2026 5 min read
Accuracy is the wrong number for a phishing classifier
A model that always guesses safe scores well when most URLs are safe. What went wrong, and what I measured instead.
The first version of my phishing detector reported an accuracy I was pleased with. The dataset was heavily imbalanced towards legitimate URLs, so a model that predicted safe every single time would have scored almost as well.
Accuracy answers a question nobody asked. The question is: of the attacks that reached the user, how many did we catch, and of the things we flagged, how many were real. That is recall and precision, and they trade against each other.
For this problem recall matters more. A false positive costs the user an annoying warning. A false negative costs them their credentials. So I fixed a recall target and optimised precision at that point, which is a much less flattering number and a much more honest one.
The other thing worth saying: check your features for leakage. One of mine encoded which source file a URL came from. Removing it dropped the score and made the model real.