GetWindowLength Calculates the size of the window. This window focuses on the real anomaly and it can be used to know if the detected anomaly is a true positive or not.
num.real.anomaly: Number of real anomalies contained in the data set.
window.length.perc: Window length in percentage of the total data
Returns
Window length as numeric.
Details
nrow.data and num.real.anomaly must be numeric. Window length is calculated by default as 10% of the length of the data set divided by the number of real anomalies contained in it.
Examples
## Generate dataset.seed(100)n <-180x <- sample(1:100, n, replace =TRUE)x[70:90]<- sample(110:115,21, replace =TRUE)x[25]<-200x[150]<-170df <- data.frame(timestamp =1:n, value = x)# Add is.real.anomaly columndf$is.real.anomaly <-0df[c(25,80,150),"is.real.anomaly"]<-1# Get window lengthGetWindowLength(data.length = nrow(df), num.real.anomaly =3)
References
A. Lavin and S. Ahmad, “Evaluating Real-time Anomaly Detection Algorithms – the Numenta Anomaly Benchmark,” in 14th International Conference on Machine Learning and Applications (IEEE ICMLA 15), 2015.