
Last chance! 50% off unlimited learning
Sale ends in
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.
GetWindowLength(data.length, num.real.anomaly, window.length.perc = 0.1)
Dataset length.
Number of real anomalies contained in the data set.
Window length in percentage of the total data
Window length as numeric.
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.
A. Lavin and S. Ahmad, <U+201C>Evaluating Real-time Anomaly Detection Algorithms <U+2013> the Numenta Anomaly Benchmark,<U+201D> in 14th International Conference on Machine Learning and Applications (IEEE ICMLA 15), 2015.
# NOT RUN {
## Generate data
set.seed(100)
n <- 180
x <- sample(1:100, n, replace = TRUE)
x[70:90] <- sample(110:115, 21, replace = TRUE)
x[25] <- 200
x[150] <- 170
df <- data.frame(timestamp = 1:n, value = x)
# Add is.real.anomaly column
df$is.real.anomaly <- 0
df[c(25,80,150), "is.real.anomaly"] <- 1
# Get window length
GetWindowLength(data.length = nrow(df), num.real.anomaly = 3)
# }
Run the code above in your browser using DataLab