Search code examples
data-miningoutlierselki

ELKI GUI output and parameter k (LOF)


I am suspicious about: Materializing k nearest neighbors (k=3) in the following output.

Verbose output from ELKI GUI, running LOFalgorithm, lof.k=2.

LOF #1/3: Materializing LOF neighborhoods.
de.lmu.ifi.dbs.elki.index.preprocessed.knn.MaterializeKNNPreprocessor.**k: 3**
Materializing k nearest neighbors **(k=3)**: 198 [100%]
de.lmu.ifi.dbs.elki.index.preprocessed.knn.MaterializeKNNPreprocessor.precomputation-time: 3 ms
LOF #2/3: Computing LRDs.
LOF #3/3: Computing LOFs.
LOF: complete.

Does that mean that ELKI looks at points' 3nn, when I set lof.k=2?


Solution

  • This is correct behaviour.

    To compute LOF fast, you need to precompute the k nearest neighbors.

    Since the k nearest neighbors in ELKI - as common in a databases - usually includes the query point, you need the k+1 nearest neighbors for LOF, to get k other points.