Techniques to detect anomalies
Before we delve into some of the more statistical and data science-focused techniques for anomaly detection, it’s worth reminding ourselves of a method we’ve already encountered – time-series decomposition. Here’s where our earlier discussions come full circle.
Anomaly detection with STL decomposition
As we discussed in the previous chapter, time-series decomposition allows us to extract underlying patterns in our data. STL decomposition, which stands for Seasonal-Trend decomposition using LOESS, is especially useful as it is robust to outliers. The outliers will be left in the residual component, enabling us to use this for anomaly detection.
Residuals in a time series often follow a normal distribution. This assumption is leveraged in anomaly detection techniques, such as the z-score method and Tukey’s rule, which we will discuss next.
The z-score
The z-score represents the number of standard deviations...