Fundamentals of Anomaly Detection
Let's take a look at the fundamentals of anomaly detection and also explore the categories of anomalies and anomaly detection techniques.
Join the DZone community and get the full member experience.Join For Free
Today, when we claim of solving problems with Data Science, we try to do one of the following things:
Getting out the predictions — This is a golden term in today's world and what most people consider when anyone quotes "Data Science" or "Machine Learning."
Generating Recommendation — It is the art of suggesting "something" to people. The use cases are like recommending products as we notice in Amazon, suggesting movies as in Netflix or recommending articles to readers.
Producing Insights — Another serviceable area of Data Science where it serves to uncover relationships and patterns in the data that are not so visible to the wide eyes.
Detecting Anomalies — It is the method to find out scenarios that are unexpected and are rare events. With the rising demand of connected systems, better security monitoring for smart cities, Server monitoring and agile fraud detections, it has become imperative to detect the anomalies as and when they occur.
In a series of articles, we will understand the different methods for detecting anomalies along with hands-on exercises using R or Python, so that anomaly detection techniques don't appear as an anomaly to us.
So, let's start with a very basic question — What's Anomaly?
As dicitionary.com defines, it is:
1. A deviation from the common rule, type, arrangement, or form.
- An anomalous person or thing; one that is abnormal or does not fit in
- An odd, peculiar, or strange condition, situation, quality, etc.
Imagine I give you the following list:
We can quickly identify the first three as parts of a computer, and television doesn't go well with the list of items. It is an anomaly in the list.
In short, an anomaly is deviating from or inconsistent with the common order, form, or rule, and which does not conform to the usual behavior of the data. For example, let's say we work in a steel manufacturing industry, and we see the quality of the steel suddenly drops down below the permissible limits. This is an anomaly; if not detected and resolved soon will cost the organization millions. So to detect an abnormality at an early stage of its occurrence is very crucial.
Categories of Anomalies
Generally, anomalies can be defined into three buckets:
1) Point Anomalies — An individual data unit deviates from the rest available data points. For example, a high credit card transaction amount compared to other available transaction done the user.
2) Contextual Anomalies — Point anomaly detected within a context. It is also known as a conditional anomaly as we define whether a point is unusual or not based on certain conditions. For example, a high transaction of 10,000 dollars during Christmas in a retail store can be considered normal while this transaction during an offseason might be flagged as an anomaly
3) Collective Anomalies — Here a group of different attributes or data points collectively indicates an anomaly. For example, in a smart car, if it's speed drops suddenly, the brake is applied, and the windshield is broken, then collectively we can infer that there is an accident which is an anomaly.
Gone are the days when detecting anomalies were considered a simple task. It is very challenging now, when we deal with data that moves fast, grows faster, and changes frequently. The other aspect that makes it challenging is the agility of detecting anomalies when it occurs. It should adapt to the rapidly evolving metric's baseline. Broadly, there are two types of anomaly detection techniques that can be used separately or used together to create a robust anomaly detection engine.
Type of Anomaly Detection Techniques
Rule-based systems are usually designed by defining rules that describe an anomaly and assigning thresholds and limits. For example, anything above the threshold or below is classified as an anomaly. Rule-based systems are designed from the experience of the industry experts and can be thought of as systems that are designed to detect “known anomalies.” They are "known anomalies" because we recognize what is usual and what is not usual.
However, if there is something that is not known and has never been discovered so far, then creating rules for detecting anomalies is difficult. In such cases, machine learning-based detection systems come in handy. They are a bit complicated but can deal with many uncertain situations. Mostly, they can deduce the patterns that are unusual and alert the users.
In the next piece of this series, we the various techniques of Machine Learning based anomaly detection methods.
Opinions expressed by DZone contributors are their own.