Blockchain Powered IoT: Anomaly Detection
Anomaly detection is used widely to perform various tasks such as fraud detection in the financial industry, network breach for cyber-security, and enemy surveillance for the military . Data scientists apply various models to find anomalies, using a range of techniques from statistics to machine learning. However, the explosion of time series data generated by the Internet of Things (IoT) has made this task more challenging than ever.
The example above shows a data stream which represents machine temperatures recorded over time. Anomalies are marked by a red circle within the pink shaded anomaly windows . Applying this data to a Machine Learning algorithm will result in automated detection of the anomalies.
It is important to establish some boundaries on the definition of an anomaly . Anomalies can be broadly categorized as:
Point anomalies: A single instance of data is anomalous if it's too far off from the rest. Business use case: Detecting credit card fraud based on "amount spent."
Contextual anomalies: The abnormality is context specific. This type of anomaly is common in time-series data. Business use case: Spending $100 on food every day during the holiday season is normal but may be odd otherwise.
Collective anomalies: A set of data instances collectively helps in detecting anomalies. Business use case: Someone is trying to copy data form a remote machine to a local host unexpectedly, an anomaly that would be flagged as a potential cyber-attack.
Anomaly detection is similar to, but not entirely the same as noise removal. Noise removal is the process of immunizing analysis from the occurrence of unwanted observations; in other words, removing noise from an otherwise meaningful signal.
The simplest approach to identifying irregularities in data is to flag the data points that deviate from common statistical properties of a distribution, including mean, median, mode, and quantiles. Let's say the definition of an anomalous data point is one that deviates by a certain standard deviation from the mean. Traversing mean over time-series data isn't exactly trivial, as it's not static. You would need a rolling window to compute the average across the data points. Technically, this is called a rolling average or a moving average, and it's intended to smooth short-term fluctuations and highlight long-term ones. Mathematically, an n-period simple moving average can also be defined as a "low pass filter."
The low pass filter allows you to identify anomalies in simple use cases, but there are certain situations where this technique won't work. Here are a few:
1) The data contains noise which might be similar to abnormal behavior, because the boundary between normal and abnormal behavior is often not precise.
2) The definition of abnormal or normal may frequently change, as malicious adversaries constantly adapt themselves. Therefore, the threshold based on moving average may not always apply.
3) The pattern is based on seasonality. This involves more sophisticated methods, such as decomposing the data into multiple trends to identify the change in seasonality.
For the cases 1-3 above, we will need to apply a more sophisticated approach based on Machine Learning.
Machine Learning based approaches will be the subject of a subsequent Blog.
 Detecting Anomalies in IoT with Time Series Analysis, July 26, 2016, Zenrichsocial
 Introduction to Anomaly Detection, Pranit Choudhary, 02.14.17