| EorelmAD | R Documentation | 
R6 class that implements our ensemble-based online recurrent extreme learning machine anomaly detector (EORELM-AD). EORELM-AD is an online univariate time series anomaly detector based on an online recurrent extreme learning machine (OR-ELM) prediction model proposed by J. M. Park and J. H. Kim (2017) <doi:10.1109/IJCNN.2017.7966094>. ORELM is an online learning algorithm that trains single-hidden layer feedforward neural networks (SLFNs), able to learn data one-by-one or chunk-by-chunk with fixed or varying data size.
EORELM-AD implements several online normalization techniques needed to train ORLEM. Then, based on a window of normalized previous values it predicts the value of the current data point using an ensemble of OR-ELMs initialized with different parameters. Finally, the anomaly score and the anomaly label are computed based on past prediction errors. For this aim, several scoring methods are available.
new()Create a new EorelmAD object.
EorelmAD$new( n.train, numLags = 100, ncomb = 30, k = 6, numHiddenNeurons = c(20, 25, 30, 35, 40, 45, 50), outputWeightForgettingFactor = seq(0.9, 1, 0.01), inputWeightForgettingFactor = 1, normMethod = "DN", normParams = NULL, outlierMethod = "DS", outlierParams = list(), threshold = 0.5, reduceFP = FALSE )
n.trainNumber of points of the dataset that correspond to the training set.
n.train must be greater or equal to numLags + 2.
numLagsNumber of past values needed to make the prediction. numLags must be
lower or equal to n.train - 2.
ncombNumber of base learners to initialize during the training stage.
kNumer of best base learners to be used during the test stage.
numHiddenNeuronsNumber or vector of possible values of hidden neurons.
outputWeightForgettingFactorValue or vector of possible values of the output weight forgetting factor. All values must be between 0 and 1. If it is 1, it does not forget anything.
inputWeightForgettingFactorValue or vector of possible values of the input weight forgetting factor. All values must be between 0 and 1. If it is 1, it does not forget anything.
normMethodThe normalization method to be used. Possible values are: NULL, "WN",
"DN", "OAN", and "OAMN". Note that if the value of normMethod is NULL, the input data
must be previously normalized or standardized.
normParamsA list with the additional parameters to configure selected
normMethod; by default NULL. Please for more details see,
WindowNormalizer (WN), DynamicNormalizer (DN),
AdaptiveNormalizer (OAN), AdaptiveNormalizer2 (OAMN).
outlierMethodThe outlier method to be used to compute the anomaly score based on historical prediction errors. Possible values are: "AL", "DT", "SS" and "DSS".
outlierParamsA list with the additional parameters to configure selected
outlierMethod; by default empty list. Please for more details see,
AnomalyLikelihoodScorer(AL), DynamicThresholdScorer (DT),
SigmaScorer (SS) and DynamicSigmaScorer (DSS).
thresholdAnomaly threshold. A integer value between [0,1].
reduceFPIf TRUE reduces false positives.
A new EorelmAD object.
predict()It determines whether or not the current value is an anomaly and its degree of abnormality.
EorelmAD$predict(x)
xNew data value to be evaluated.
Dataset conformed by the following columns:
predictedInput  |  Standardized predicted value for the current input x.  | 
normalizedInput  |  Normalized value of the current input x.  | 
error  | Prediction error. | 
is.anomaly  | 1 if the value is anomalous, 0 otherwise. | 
anomaly.score  | Probability of anomaly. | 
J. M. Park and J. H. Kim, Online recurrent extreme learning machine and its application to time-series prediction, in Proceedings of the International Joint Conference on Neural Networks, 2017, pp. 1983–1990.
## Generate data set.seed(100) n <- 350 x <- sample(1:100, n, replace = TRUE) x[70:90] <- sample(110:115, 21, replace = TRUE) x[25] <- 200 x[320] <- 170 df <- data.frame(timestamp = 1:n, value = x) ## Calculate anomalies detector <- EorelmAD$new( n.train = 20, numLags = 10, numHiddenNeurons = c(20), normMethod = NULL, outlierMethod = "DSS", threshold = 0.5 ) result <- detector$predict(df$value) ## Plot results res <- cbind(df, result) PlotDetections(res, title = "EORELM-AD ANOMALY DETECTOR", return.ggplot = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.