Research Article

A Log-Based Anomaly Detection Method with Efficient Neighbor Searching and Automatic K Neighbor Selection

Algorithm 4

The strategy of anomaly detection.
Require: The sample to be detected S. An actual neighbor set containing neighbor samples for sample S. A positive sample set containing m normal samples in . A negative sample set containing n abnormal samples in Actual_Neighbor .
Ensure: The label of S
(1)function (P, F, m, n)
(2)fordo
(3)  
(4)end for
(5)for jdo
(6)  
(7)end for
(8)ifthen
(9)  return normal
(10)else
(11)  return abnormal
(12)end if
(21)end function