Professional Documents
Culture Documents
L32-LOF Example PDF
L32-LOF Example PDF
L32-LOF Example PDF
The lower the local reachability density of o, and the higher the local
reachability density of the kNN of o, the higher LOF
This captures a local outlier whose local density is relatively low
comparing to the local densities of its kNN
2
LOF(Local Outlier Factor) Example
• Consider the following 4 data points:
a(0, 0), b(0, 1), c(1, 1), d(3, 0)
Calculate the LOF for each point and show the
top 1 outlier, set k = 2 and use Manhattan
Distance.
Step 1: calculate all the distances
between each two data points
• There are 4 data points:
a(0, 0), b(0, 1), c(1, 1), d(3, 0)
(Manhattan Distance here)
dist(a, b) = 1
dist(a, c) = 2
dist(a, d) = 3
dist(b, c) = 1
dist(b, d) = 3+1=4
dist(c, d) = 2+1=3
Step 2: calculate all the dist2(o)
• distk(o): distance between o and its k-th
NN( k-th nearest neighbor)
N2(a) = {b, c}
N2(b) = {a, c}
N2(c) = {b, a}
N2(d) = {a, c}
Step 4: calculate all the lrdk(o)
lrdk(o): Local Reachability Density of o
|| N2(a) ||
lrdk(a) =
reachdist2(b←a)+reachdist2(c←a)
Step 4: calculate all the lrdk(o)
|| N2(b) ||
lrd2(b) = =2/(2+2) = 0.5
reachdist2(a←b)+reachdist2(c←b)
|| N2(c) ||
lrd2(c) = =2/(1+2) = 0.667
reachdist2(b←c)+reachdist2(a←c)
|| N2(b) ||
lrd2(d) = =2/(3+3) = 0.33
reachdist2(a←d)+reachdist2(c←d)
Step 5: calculate all the LOFk(o)
LOF2(a) =
(lrd2(b) + lrd2(c)) * (reachdist2(b ← a) + reachdist2(𝑐 ← a))
= (0.5+0.667) * (1+2) = 3.501
LOF2(b) =
(lrd2(a) + lrd2(c)) * (reachdist2(a ← b) + reachdist2(𝑐 ← b))
= (0.667+0.667) * (2+2) = 5.336
Step 5: calculate all the LOFk(o)
LOF2(c) =
(lrd2(b) + lrd2(a)) * (reachdist2(b ← c) + reachdist2(𝑎 ← c))
= (0.5+0.667) * (1+2) = 3.501
LOF2(d) =
(lrd2(a) + lrd2(c)) * (reachdist2(a ← d) + reachdist2(𝑐 ← d))
= (0.667+0.667) * (3+3) = 8.004
Step 6: Sort all the LOFk(o)
The sorted order is:
LOF2(d) = 8.004
LOF2(b) = 5.336
LOF2(a) = 3.501
LOF2(c) = 3.501