Skip to contents

Each point's local reachability density against the mean density of its k neighbours. A LOF near 1 is normal; well above 1 means the point sits in a sparser region than its neighbours do.

Usage

morie_local_outlier_factor(X, k = 20)

Arguments

X

numeric matrix, one row per observation.

k

neighbourhood size.

Value

list with lof, score (same vector), rank, lrd, k_distance and neighbors (0-based indices, to match the Python module).

Details

The relativity is the whole point and also the limitation: a genuinely sparse but self-consistent cluster is not flagged, because every member is exactly as sparse as its neighbours.

References

Breunig, M. M., Kriegel, H.-P., Ng, R. T. and Sander, J. (2000). LOF: identifying density-based local outliers. SIGMOD, 93-104.

Examples

set.seed(1)
X <- rbind(matrix(rnorm(100), ncol = 2), c(6, 6))
round(max(morie_local_outlier_factor(X, k = 5)$lof), 3)
#> [1] 7.906