Algorithm Search⌘K

Algorithmcore

Local outlier factor

Also called LOF.

Scores each point by the mean local reachability density of its k nearest neighbors divided by its own, so a point in a sparser place than its neighbors scores well above 1.

Time
O(n^2 (d + log n)) worst
Space
O(n^2) extra
Where
d = the dimension; k = the number of neighbors; n = the number of points
Properties
deterministicexactofflineiterative
Origin
Markus M. Breunig, Hans Peter Kriegel, Raymond T. Ng, Jörg Sander, 2000

The local outlier factor LOFk(p)\mathrm{LOF}_k(p) compares how crowded the place around a point pp is with how crowded the places around its kk nearest neighbors are. A value near 1 means pp is as dense as its neighbors. A value well above 1 means pp sits in a sparser place than they do, which makes it a local outlier. Breunig, Kriegel, Ng and Sander (2000) defined it for the anomaly detection problem because a single global distance threshold, as in kNN outlier detection, fails when the clusters of normal data have different densities.

In plain words

Picture a city with a crowded center and quiet suburbs. A house in the suburbs is far from its neighbors, but so are all the other suburb houses, so it is normal there. A house just outside the crowded center, at a distance that would be small in the suburbs, is odd: its neighbors are in the center and they are much closer to each other than to it.

LOF measures this. For each point, estimate how dense its own neighborhood is. Then divide the average density of its neighbors by its own density. Points that are as dense as their neighbors get about 1. Points that are much less dense than their neighbors get a large number.

The problem

The input is a list of pairwise distinct points x1,…,xn∈Rdx_1, \ldots, x_n \in \mathbb{R}^d with the Euclidean distance dist\mathrm{dist}, and an integer kk with 1≤k≤n−11 \le k \le n - 1. In the paper kk is called MinPts. The definitions are these.

  • The kk-distance kd(p)\mathrm{kd}(p) is the kk-th smallest of the distances from pp to the other points.
  • The kk-distance neighborhood Nk(p)N_k(p) is the set of other points oo with dist(p,o)≤kd(p)\mathrm{dist}(p, o) \le \mathrm{kd}(p). It holds at least kk points, and more when distances tie.
  • The reachability distance of pp from oo is reach(p,o)=max⁡(kd(o),dist(p,o))\mathrm{reach}(p, o) = \max(\mathrm{kd}(o), \mathrm{dist}(p, o)).
  • The local reachability density is lrd(p)=∣Nk(p)∣ / ∑o∈Nk(p)reach(p,o)\mathrm{lrd}(p) = |N_k(p)| \,/\, \sum_{o \in N_k(p)} \mathrm{reach}(p, o), the inverse of the mean reachability distance.
  • The local outlier factor is LOFk(p)=1∣Nk(p)∣∑o∈Nk(p)lrd(o)/lrd(p)\mathrm{LOF}_k(p) = \frac{1}{|N_k(p)|} \sum_{o \in N_k(p)} \mathrm{lrd}(o) / \mathrm{lrd}(p).

The output is LOFk(xi)\mathrm{LOF}_k(x_i) for every ii. Ranking the points by this value, or flagging those above a threshold, is a separate step; the threshold is a heuristic choice.

The algorithm

  1. LOCAL-OUTLIER-FACTOR(x[1..n], k)
  2. 1for p ← 1 to n do
  3. 2R ← the pairs (dist(x_p, x_o), o) for all o ≠ p, sorted by distance
  4. 3kd[p] ← the distance of the k-th pair of R
  5. 4N[p] ← the pairs of R with distance ≤ kd[p]
  6. 5for p ← 1 to n do
  7. 6s ← the sum over (o, δ) in N[p] of max(kd[o], δ)
  8. 7lrd[p] ← |N[p]| / s
  9. 8for p ← 1 to n do
  10. 9lof[p] ← (the sum over (o, δ) in N[p] of lrd[o]) / (|N[p]| · lrd[p])
  11. 10return lof

The first pass, lines L1 to L4, finds the kk-distance and the neighborhood of every point. The neighborhood keeps all points tied at the kk-distance, so it can have more than kk members. The second pass needs the kk-distance of every neighbor, which is why it is a separate loop: line L6 sums the reachability distances and line L7 inverts their mean. The third pass needs the density of every neighbor, so it also waits until the second pass is done. Line L9 divides the mean density of the neighbors by the density of the point.

The reachability distance smooths the density. For a neighbor oo, all points closer to oo than kd(o)\mathrm{kd}(o) count as being at distance kd(o)\mathrm{kd}(o), so small changes in a dense cluster do not change lrd\mathrm{lrd} much.

Example

Take k=2k = 2 and the nine points 0,1,2,3,7,20,30,40,500, 1, 2, 3, 7, 20, 30, 40, 50 on a line. The points 00 to 33 form a dense cluster with gaps of 1. The points 2020 to 5050 form a sparse cluster with gaps of 10. The point 77 is 4 away from the dense cluster.

point kd N2N_2 reach distances lrd LOF
0 2 1, 2 1, 2 2/3 1.0
1 1 0, 2 2, 1 2/3 1.0
2 1 1, 3 1, 2 2/3 1.0
3 2 1, 2 2, 1 2/3 1.0
7 5 2, 3 5, 4 2/9 = 0.2222 3.0
20 13 7, 30 13, 10 2/23 = 0.0870 1.7778
30 10 20, 40 13, 10 2/23 = 0.0870 0.8833
40 10 30, 50 10, 20 1/15 = 0.0667 1.1522
50 20 30, 40 20, 10 1/15 = 0.0667 1.1522

The point 1 has two neighbors at distance 1, so its kk-distance is 1. For the point 7, the reachability distance from the point 2 is max⁡(kd(2),5)=5\max(\mathrm{kd}(2), 5) = 5 and from the point 3 it is max⁡(2,4)=4\max(2, 4) = 4, so lrd(7)=2/9\mathrm{lrd}(7) = 2/9. Its neighbors have density 2/32/3, three times larger, so LOF2(7)=3\mathrm{LOF}_2(7) = 3, the largest value. The kNN score D2D^2 ranks the point 7 (score 5) below all the points of the sparse cluster (scores 10 to 20). LOF ranks it first, and the sparse points stay near 1. The point 20 gets 1.78 because one of its two neighbors is the point 7.

Correctness

Each pass computes one of the definitions for all points, and each pass reads only values that an earlier pass finished. Line L3 is the kk-distance because the row is sorted, and line L4 keeps exactly the points within it. Line L6 adds the reachability distances, because kd[o]\mathrm{kd}[o] is final for every oo after the first pass. Line L9 is the definition of LOF, because every lrd[o]\mathrm{lrd}[o] is final after the second pass. The denominators are positive when the points are distinct: every reachability distance is at least dist(p,o)>0\mathrm{dist}(p, o) > 0.

Breunig et al. also prove bounds on the value (Theorem 1). Let direct_min and direct_max be the smallest and the largest of reach(p,o)\mathrm{reach}(p, o) over o∈Nk(p)o \in N_k(p), and indirect_min and indirect_max the same over reach(o,q)\mathrm{reach}(o, q) for o∈Nk(p)o \in N_k(p) and q∈Nk(o)q \in N_k(o). Then direct_min / indirect_max ≤LOFk(p)≤\le \mathrm{LOF}_k(p) \le direct_max / indirect_min. The proof and the bound are in the proofs section below.

Proof: The three passes compute LOF as defined, and LOF lies between the direct and indirect boundsfull

Setting. The points x1,…,xnx_1, \ldots, x_n are pairwise distinct and 1≤k≤n−11 \le k \le n - 1. We write kd(p)\mathrm{kd}(p), Nk(p)N_k(p), reach(p,o)=max⁡(kd(o),dist(p,o))\mathrm{reach}(p, o) = \max(\mathrm{kd}(o), \mathrm{dist}(p, o)), lrd(p)\mathrm{lrd}(p) and LOFk(p)\mathrm{LOF}_k(p) for the quantities of the problem statement.

Termination. Each of the three loops runs over p=1,…,np = 1, \ldots, n. Each body does a finite amount of work: a sort of n−1n - 1 pairs, and sums over a list of at most n−1n - 1 pairs. So the procedure stops.

Claim 1 (first pass). After the loop of lines L1 to L4, kd[p]=kd(p)\mathrm{kd}[p] = \mathrm{kd}(p) and N[p]N[p] is the list of pairs (o,dist(p,o))(o, \mathrm{dist}(p, o)) for o∈Nk(p)o \in N_k(p), for every pp.

Proof. Line L2 lists the distances from pp to all n−1n - 1 other points in increasing order. Since k≤n−1k \le n - 1, the kk-th pair exists, and its distance is the kk-th smallest distance, which is kd(p)\mathrm{kd}(p) by definition. Line L4 keeps exactly the pairs with distance at most kd(p)\mathrm{kd}(p), which is the definition of Nk(p)N_k(p). The value for pp is not changed later in the loop. □\square

Claim 2 (second pass). After the loop of lines L5 to L7, lrd[p]=lrd(p)\mathrm{lrd}[p] = \mathrm{lrd}(p) for every pp, and every value is positive and finite.

Proof. By Claim 1, when the second loop starts, kd[o]\mathrm{kd}[o] is final for every oo and N[p]N[p] is Nk(p)N_k(p) with the distances. So line L6 computes s=∑o∈Nk(p)max⁡(kd(o),dist(p,o))=∑o∈Nk(p)reach(p,o)s = \sum_{o \in N_k(p)} \max(\mathrm{kd}(o), \mathrm{dist}(p, o)) = \sum_{o \in N_k(p)} \mathrm{reach}(p, o). Because the points are distinct, dist(p,o)>0\mathrm{dist}(p, o) > 0 for o≠po \ne p, so each term is positive and s>0s > 0. The set Nk(p)N_k(p) has at least k≥1k \ge 1 members. Line L7 sets lrd[p]=∣Nk(p)∣/s\mathrm{lrd}[p] = |N_k(p)| / s, which is the definition of lrd(p)\mathrm{lrd}(p) and lies in (0,∞)(0, \infty). □\square

Claim 3 (third pass). After the loop of lines L8 and L9, lof[p]=LOFk(p)\mathrm{lof}[p] = \mathrm{LOF}_k(p) for every pp.

Proof. By Claim 2, every lrd[o]\mathrm{lrd}[o] is final and positive when the third loop starts. Line L9 computes (∑o∈Nk(p)lrd(o))/(∣Nk(p)∣⋅lrd(p))\big(\sum_{o \in N_k(p)} \mathrm{lrd}(o)\big) / \big(|N_k(p)| \cdot \mathrm{lrd}(p)\big), which is the definition of LOFk(p)\mathrm{LOF}_k(p), and the denominator is positive. Line L10 returns these values. □\square

Theorem (Breunig et al., Theorem 1). For every point pp, let

dmin=min⁡o∈Nk(p)reach(p,o),dmax=max⁡o∈Nk(p)reach(p,o),\mathrm{dmin} = \min_{o \in N_k(p)} \mathrm{reach}(p, o), \qquad \mathrm{dmax} = \max_{o \in N_k(p)} \mathrm{reach}(p, o),

and let imin\mathrm{imin} and imax\mathrm{imax} be the smallest and largest of reach(o,q)\mathrm{reach}(o, q) over all o∈Nk(p)o \in N_k(p) and q∈Nk(o)q \in N_k(o). Then

dminimax≤LOFk(p)≤dmaximin.\frac{\mathrm{dmin}}{\mathrm{imax}} \le \mathrm{LOF}_k(p) \le \frac{\mathrm{dmax}}{\mathrm{imin}}.

Proof. The value 1/lrd(p)1 / \mathrm{lrd}(p) is the mean of the numbers reach(p,o)\mathrm{reach}(p, o), o∈Nk(p)o \in N_k(p). A mean lies between the smallest and the largest of the numbers, so dmin≤1/lrd(p)≤dmax\mathrm{dmin} \le 1 / \mathrm{lrd}(p) \le \mathrm{dmax}. In the same way, for each o∈Nk(p)o \in N_k(p), 1/lrd(o)1 / \mathrm{lrd}(o) is the mean of reach(o,q)\mathrm{reach}(o, q) over q∈Nk(o)q \in N_k(o), and each of these numbers is between imin\mathrm{imin} and imax\mathrm{imax}. So 1/imax≤lrd(o)≤1/imin1 / \mathrm{imax} \le \mathrm{lrd}(o) \le 1 / \mathrm{imin} for each neighbor oo, and the mean ℓˉ\bar\ell of lrd(o)\mathrm{lrd}(o) over o∈Nk(p)o \in N_k(p) satisfies the same bounds. By definition LOFk(p)=ℓˉ⋅(1/lrd(p))\mathrm{LOF}_k(p) = \bar\ell \cdot (1 / \mathrm{lrd}(p)), a product of two positive numbers. The product of the lower bounds gives dmin/imax≤LOFk(p)\mathrm{dmin} / \mathrm{imax} \le \mathrm{LOF}_k(p), and the product of the upper bounds gives LOFk(p)≤dmax/imin\mathrm{LOF}_k(p) \le \mathrm{dmax} / \mathrm{imin}. □\square

Corollary (values near 1 in a cluster). If all the numbers reach(p,o)\mathrm{reach}(p, o) and reach(o,q)\mathrm{reach}(o, q) above lie in an interval [r,(1+ϵ)r][r, (1 + \epsilon) r] with r>0r > 0, then 1/(1+ϵ)≤LOFk(p)≤1+ϵ1 / (1 + \epsilon) \le \mathrm{LOF}_k(p) \le 1 + \epsilon. This follows from the theorem with dmin,imin≥r\mathrm{dmin}, \mathrm{imin} \ge r and dmax,imax≤(1+ϵ)r\mathrm{dmax}, \mathrm{imax} \le (1 + \epsilon) r.

By Claims 1 to 3 the procedure returns LOFk(xi)\mathrm{LOF}_k(x_i) for every ii, and the theorem gives the bounds that the tests check on random inputs. ■\blacksquare

Complexity

The cost is in the real-RAM model.

  • Time. Line L2 computes n−1n - 1 distances in Θ(nd)\Theta(n d) time and sorts them in Θ(nlog⁡n)\Theta(n \log n) time, for each of the nn points. The two later passes take time proportional to the total size of the neighborhoods, which is at most n(n−1)n(n - 1). The total is Θ(n2(d+log⁡n))\Theta(n^2 (d + \log n)). A selection of the kk-th distance instead of a sort brings the first pass to Θ(n2d)\Theta(n^2 d).
  • Space. The neighborhoods take O(nk)O(n k) space when there are no ties and O(n2)O(n^2) in the worst case, when many distances are equal.
  • With an index. An index for nearest neighbor queries, such as a k-d tree in low dimension, can replace the scan of line L2. Then the first pass costs nn queries, and the two later passes are linear in the size of the stored neighborhoods.

Properties

  • Local. The value compares a point only with its neighbors, so one threshold works across clusters of different densities.
  • Near 1 inside a cluster. For a point deep inside a cluster where the reachability distances are all about equal, the value is about 1. Theorem 1 makes this exact: if all the direct and indirect reachability distances are within a factor 1+ϵ1 + \epsilon of each other, the value is within that factor of 1.
  • Not a probability. There is no fixed cut that means "outlier". A value of 1.5 can be strong in one data set and weak in another; the threshold is a heuristic.
  • Scale invariant, not unit invariant. Multiplying all coordinates by the same factor leaves LOF unchanged, because it is a ratio of distances. Changing the units of one feature does change it.

Variants and improvements

  • A range of kk. The paper studies how LOF changes with MinPts. It suggests computing LOF for a range of values, up to about the size of the smallest group that should still count as normal, and ranking each point by its largest value over the range. This is a heuristic.
  • Novelty detection. To score a new point zz against a fixed training set, compute Nk(z)N_k(z), the reachability distances and lrd(z)\mathrm{lrd}(z) against the training points, and divide the mean lrd\mathrm{lrd} of its neighbors by lrd(z)\mathrm{lrd}(z). The training values do not change.
  • Approximate neighbors. In high dimension, approximate nearest neighbor search gives the neighborhoods faster, at the cost of exact values.
  • Clustering with the same quantities. The kk-distance and the reachability distance are close to the core distance and the reachability distance of OPTICS, a relative of DBSCAN from the same research group.

When to use it

Use it on numeric data of low or moderate dimension when normal data form clusters of different densities and outliers are points that are sparse compared with their own surroundings. Use kNN outlier detection when the clusters have similar density and only the global top mm is needed, since its pruning makes it faster. Use the isolation forest for large nn, since LOF needs the neighbors of every point.

Pitfalls

  • Duplicates. If kk or more other points are equal to pp, then kd(p)=0\mathrm{kd}(p) = 0, and if all the neighbors of a point have kk-distance 0 and distance 0, the sum of line L6 is 0 and line L7 divides by zero. Remove or count duplicates first, or use kk larger than the largest number of copies. The code raises an error instead of returning a wrong value.
  • Exactly kk neighbors. If line L4 keeps only the first kk pairs of the sorted row, ties at the kk-distance are broken by the order of the input and the result depends on that order. Line L4 must keep every pair with distance ≤kd[p]\le \mathrm{kd}[p].
  • Using dist instead of reach. If line L6 sums dist(p,o)\mathrm{dist}(p, o) instead of max⁡(kd[o],dist(p,o))\max(\mathrm{kd}[o], \mathrm{dist}(p, o)), the density of points in a dense cluster changes a lot with small moves, and the values inside a cluster scatter around 1.
  • Reachability in the wrong direction. The reachability distance of pp from oo uses kd(o)\mathrm{kd}(o), the kk-distance of the neighbor, not of pp. Line L6 must read kd[o]\mathrm{kd}[o].
  • One pass. Computing lrd\mathrm{lrd} inside the first loop reads kk-distances that are not yet known. The three loops must stay separate.

Implementations

Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.

local_outlier_factor.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/local-outlier-factor/. The authors are listed in prov/45657B.jsonl.

import math
from typing import Sequence

Point = Sequence[float]


def local_outlier_factor(x: Sequence[Point], k: int) -> list[float]:
    """Return the local outlier factor LOF_k of each point, in input order.

    The definitions are those of Breunig, Kriegel, Ng and Sander (2000), with
    k in the role of MinPts: the k-distance, the k-distance neighborhood (which
    holds more than k points when distances tie), the reachability distance,
    the local reachability density lrd and LOF. A value near 1 means the point
    is as dense as its neighbors; a large value means it is in a sparser place.
    Precondition: 1 <= k <= len(x) - 1, the points are pairwise distinct and
    have one dimension d. Cost: Theta(n^2 d + n^2 log n) time with a sort of
    each row, O(n^2) extra space in the worst case of many ties, O(n k) when
    the neighborhoods have size k.
    """
    n = len(x)
    if not 1 <= k <= n - 1:
        raise ValueError("need 1 <= k <= n - 1")
    kdist = [0.0] * n
    nbrs: list[list[tuple[int, float]]] = []
    for p in range(n):  # @line L1
        row = sorted((math.dist(x[p], x[o]), o) for o in range(n) if o != p)  # @line L2
        kdist[p] = row[k - 1][0]  # @line L3
        nbrs.append([(o, dpo) for dpo, o in row if dpo <= kdist[p]])  # @line L4
    lrd = [0.0] * n
    for p in range(n):  # @line L5
        total = sum(max(kdist[o], dpo) for o, dpo in nbrs[p])  # @line L6
        if total == 0.0:
            raise ValueError("duplicate points give an infinite density")
        lrd[p] = len(nbrs[p]) / total  # @line L7
    lof = [0.0] * n
    for p in range(n):  # @line L8
        lof[p] = sum(lrd[o] for o, _ in nbrs[p]) / (len(nbrs[p]) * lrd[p])  # @line L9
    return lof  # @line L10
test_local_outlier_factor.py 101 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/local-outlier-factor/. The authors are listed in prov/45657B.jsonl.

import itertools
import math
import random
from fractions import Fraction

import pytest

from local_outlier_factor import local_outlier_factor

LINE = [0, 1, 2, 3, 7, 20, 30, 40, 50]


def oracle(x, k, dist):
    """LOF from the formulas of Breunig et al., on the full distance matrix."""
    n = len(x)
    d = [[dist(x[i], x[j]) for j in range(n)] for i in range(n)]
    kd = [sorted(d[i][j] for j in range(n) if j != i)[k - 1] for i in range(n)]
    nb = [[j for j in range(n) if j != i and d[i][j] <= kd[i]] for i in range(n)]
    reach = lambda p, o: max(kd[o], d[p][o])
    lrd = [len(nb[p]) / sum(reach(p, o) for o in nb[p]) for p in range(n)]
    lof = [sum(lrd[o] for o in nb[p]) / (len(nb[p]) * lrd[p]) for p in range(n)]
    return lof, nb, reach


def exact_line(values, k):
    pts = [Fraction(v) for v in values]
    lof, _, _ = oracle(pts, k, lambda a, b: abs(a - b))
    return lof


def test_example() -> None:
    got = local_outlier_factor([(float(v),) for v in LINE], 2)
    want = exact_line(LINE, 2)
    assert want[4] == 3
    assert want[:4] == [1, 1, 1, 1]
    assert want[5] == Fraction(16, 9)
    for g, w in zip(got, want):
        assert math.isclose(g, float(w), rel_tol=1e-12)
    assert max(range(len(got)), key=lambda i: got[i]) == 4


def test_edges() -> None:
    assert local_outlier_factor([(0.0,), (1.0,)], 1) == [1.0, 1.0]
    grid = [(float(a), float(b)) for a in range(3) for b in range(3)]
    lof = local_outlier_factor(grid, 4)
    want, _, _ = oracle(grid, 4, math.dist)
    for g, w in zip(lof, want):
        assert math.isclose(g, w, rel_tol=1e-12)
    with pytest.raises(ValueError):
        local_outlier_factor([(0.0,), (1.0,)], 2)
    with pytest.raises(ValueError):
        local_outlier_factor([(0.0,), (0.0,), (5.0,)], 1)


def test_random_against_formula_and_bounds() -> None:
    rng = random.Random(2000)
    for trial in range(500):
        d = rng.randint(1, 3)
        cells = list(itertools.product(range(-3, 4), repeat=d))
        n = rng.randint(2, min(12, len(cells)))
        x = [tuple(float(c) for c in p) for p in rng.sample(cells, n)]
        k = rng.randint(1, n - 1)
        got = local_outlier_factor(x, k)
        want, nb, reach = oracle(x, k, math.dist)
        for p in range(n):
            assert math.isclose(got[p], want[p], rel_tol=1e-9)
            # Theorem 1 of Breunig et al.: direct_min / indirect_max <= LOF <= direct_max / indirect_min.
            direct = [reach(p, q) for q in nb[p]]
            indirect = [reach(q, o) for q in nb[p] for o in nb[q]]
            assert min(direct) / max(indirect) <= got[p] * (1 + 1e-9)
            assert got[p] <= max(direct) / min(indirect) * (1 + 1e-9)


def test_exact_on_integer_lines() -> None:
    rng = random.Random(31)
    for _ in range(200):
        n = rng.randint(2, 10)
        values = rng.sample(range(-20, 21), n)
        k = rng.randint(1, n - 1)
        got = local_outlier_factor([(float(v),) for v in values], k)
        for g, w in zip(got, exact_line(values, k)):
            assert math.isclose(g, float(w), rel_tol=1e-12)


def test_local_outlier_beats_sparse_cluster() -> None:
    rng = random.Random(5)
    found = 0
    trials = 30
    for _ in range(trials):
        dense = [(rng.gauss(0, 0.3), rng.gauss(0, 0.3)) for _ in range(30)]
        sparse = [(rng.gauss(10, 3), rng.gauss(10, 3)) for _ in range(30)]
        planted = (2.5, 0.0)
        x = dense + sparse + [planted]
        lof = local_outlier_factor(x, 5)
        ranked = sorted(range(len(x)), key=lambda i: -lof[i])
        found += len(x) - 1 in ranked[:3]
    # A point at 8 standard deviations from the dense cluster: expect it in the top 3 in at least 90 percent of runs.
    assert found / trials >= 0.9

History

Breunig, Kriegel, Ng and Sander presented the local outlier factor at SIGMOD 2000. Earlier distance-based definitions, such as the DB(p, D) outliers of Knorr and Ng (1998) and the kk-th neighbor distance of Ramaswamy, Rastogi and Shim (2000), give a yes or no answer or a global score. LOF was the first widely used score that gives each point a degree of outlierness relative to its own neighborhood. It reuses the kk-distance and the reachability distance of the density based clustering methods of the same group, and many later local scores are variants of it.

References

  1. Markus M. Breunig, Hans-Peter Kriegel, Raymond T. Ng and Jörg Sander, LOF, identifying density-based local outliers, ACM SIGMOD 2000, pages 93 to 104, the definitions of the k-distance, the k-distance neighborhood, the reachability distance, the local reachability density (Definition 6) and LOF, and Theorem 1 (the bounds on LOF by the direct and indirect reachability distances)
  2. Varun Chandola, Arindam Banerjee and Vipin Kumar, Anomaly detection, a survey, ACM Computing Surveys 41(3), article 15, 2009, Section 5 (nearest neighbor based techniques), the part on relative density

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH1 sketch
  • a full proof of time.worst
  • a full proof of space.extra
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • at least three sources
  • a scene preset for the example