Handling Multiple Seasonal Periods
What you'll learn: How to detect anomalies in time series data that exhibit multiple overlapping seasonal patterns, such as hourly spikes within daily cycles and weekly trends.
The Challenge of Nested Seasonality
Many real-world datasets don't just have one seasonal pattern—they have several. Website traffic might show hourly patterns (peak during work hours), daily patterns (weekdays vs weekends), and even yearly patterns (holiday seasons). When you're hunting for anomalies, you need to account for all these cycles simultaneously, or you'll flag normal seasonal behavior as suspicious.
Think of it like ocean tides: you have the regular daily tide, but also monthly lunar cycles and seasonal variations. A high tide during a full moon in summer isn't an anomaly—it's expected when you understand all three cycles.
Decomposing Multiple Periods
Building on the Decomposing Seasonality concept you've learned, the technique involves:
- Identify all relevant periods: hourly (24), daily (7), weekly, etc.
- Sequential decomposition: Remove the strongest seasonal component first, then detect weaker ones in the residuals
- Simultaneous decomposition: Use methods like STL (Seasonal-Trend decomposition using Loess) with multiple seasonal periods specified
- Apply anomaly detection to residuals: Once all seasonal components are removed, use methods like ESD on what remains
The key is that after removing all known seasonal patterns, what's left (the residuals) should be relatively flat and random. Anomalies then stand out clearly because they can't be explained by any regular cycle.
Why This Matters
Without handling multiple periods, you'd either over-alert (flagging normal Monday morning spikes) or under-alert (missing true anomalies hidden within seasonal noise). The Seasonal Hybrid ESD approach you've learned extends to multiple periods by iteratively or simultaneously accounting for each cycle.
Key Takeaway: When data has overlapping seasonal patterns, decompose all relevant periods before applying anomaly detection to avoid confusing regular cycles with true outliers.