I have time series data where I use a sliding window to detect anomalies in those windows. A sliding window is an interval of the dataset that steps one datapoint for each iteration. Datapoints are seen multiple times in this way equal to the size of the window.
In short, the algorithm works like this:
- Choose window length: wl
- Learn normal data with sliding window
- Try to detect anomalies on test data with sliding window
I want to keep the sliding window method since it is necessary for the performance of the algorithm.
However, one anomaly occurs multiple times in the sliding window. When the anomaly appears in the sliding window for the first time it's on the 'right' side of the window.
How do we measure accuracy of anomaly detection in this case?
We could say that detecting the anomaly once in the window is enough or detect it wl times. What's best practice?