Home   >   User Resources   >   Online Help   >   apakNearestNeighbour.LocalOutlierFactor
 

 

Function index Version 3.0.0

apakNearestNeighbour.LocalOutlierFactor(k, DataMatrix)

Excel=apakNearestNeighbour.LocalOutlierFactor(k, DataMatrix)

Result

Calculates the local outlier factor (LOF) of each data point, based on its k nearest neighbors (Breunig et al., 2000). Returns a 1 x c vector. Values around 1 indicate a density similar to that of the neighbors; values clearly above 1 indicate outliers.

Syntax

k: number of nearest neighbors to consider, between 1 and c - 1

DataMatrix: r x c data matrix

Algorithm

The k-distance of a data point o is its distance to its k-th nearest neighbor. The reachability distance of p from o is max(k-distance(o), d(p, o)). The local reachability density lrd(p) is the inverse of the mean reachability distance of p from its k nearest neighbors. LOF(p) is the mean of lrd(o) / lrd(p) over the k nearest neighbors o of p.

Remarks

Exactly k neighbors are used. A constant of 1e-10 is added to the mean reachability distance, so that duplicate data points give finite values.

Neighbors are ranked by Euclidean distance; ties are broken by the lower column index. A data point is never its own neighbor, even if other data points have the same coordinates.

Pressing Esc aborts the calculation; the function then returns "Calculation aborted by user."