Anomaly detection
Anomaly detection is the task of finding data points, events or observations that differ markedly from what is normal in a dataset, such as one fraudulent payment among millions of ordinary ones.
Anomaly detection, also called outlier detection and sometimes novelty detection, looks for the items that do not fit. Google's machine learning glossary defines it simply as the process of identifying outliers. An anomaly is not necessarily a mistake in the data. It can be a sign of something real and important: a stolen card being used, a machine about to fail, or an intruder on a computer network.
The approach depends on what labels exist. Supervised methods, which learn from examples marked normal and abnormal, are used less than you might expect, because labelled anomalies are scarce and vastly outnumbered by normal cases. Semi-supervised methods learn what normal looks like from clean data and then test whether new cases fit. Unsupervised methods, the most common, work on unlabelled data and flag whatever stands apart. The scikit-learn library draws the line between outlier detection, where the training data already contains oddities, and novelty detection, where the training data is clean and the question is whether a new observation is unusual.
Several standard techniques show how this works in practice. The local outlier factor, introduced by Breunig and colleagues in 2000, compares how densely packed a point's neighbourhood is with its neighbours' neighbourhoods. The isolation forest, introduced by Liu, Ting and Zhou in 2008, splits the data at random again and again: unusual points get separated from the rest in fewer splits, so a short average path marks a likely anomaly. Neural approaches such as autoencoders learn to reconstruct normal data and flag the cases they reconstruct badly.
The idea has a long history in computer security. Dorothy Denning proposed using anomaly detection for intrusion detection systems in 1986, and real-time intrusion detection followed in the 1990s. Today the same methods run in card fraud systems, network monitoring and factory sensors.
Every system has to decide how unusual is unusual enough. In scikit-learn this is set by a contamination parameter, the expected share of outliers in the data. Set the bar too high and real problems slip through; set it too low and analysts drown in false alarms. The model finds what is rare. Deciding whether rare means fraud, a fault or simply an unusual but legitimate customer is still a human judgement.
Common uses include spotting fraudulent card transactions, detecting intrusions on computer networks, flagging faulty equipment from sensor readings and catching errors in data. In each case the goal is to find the small number of cases that behave differently from the rest so a person or system can look at them. In outlier detection the training data already contains some unusual points, and the method has to find them. In novelty detection the training data is assumed to be clean, and the method judges whether new observations fit the pattern it learned. Both are forms of anomaly detection. It can be either, but unsupervised methods are the most common. Labelled examples of anomalies are usually rare, so most systems learn what normal data looks like and flag departures from it rather than learning from a list of known anomalies. An isolation forest builds many trees that split the data on randomly chosen features at random values. Unusual points end up isolated after only a few splits, while typical points take many. Averaging the number of splits across the trees gives a score, and points with consistently short paths are flagged as likely anomalies.Common questions
What is anomaly detection used for?
What is the difference between outlier detection and novelty detection?
Is anomaly detection supervised or unsupervised?
How does an isolation forest work?
Search for "anomaly detection survey", "isolation forest", "local outlier factor" or "novelty detection" to go deeper. Reliable sources include the documentation of established libraries such as scikit-learn, peer-reviewed surveys such as Chandola, Banerjee and Kumar's 2009 survey in ACM Computing Surveys, and encyclopedia articles that cite the original papers. Treat vendor claims of near-perfect detection rates with caution unless they also report false alarm rates and how the test data was chosen.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.