Log inStart free
LESSON 4.39 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Local Outlier Factor

Watch each point's density meet the density of its neighbors.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 4.39 · DENSITY BAYGAPS: DENSE 0.09 · SPARSE 0.39 · 40: 1.00
01
Stage 1 of 6 · Two densities
Nearest gaps are about 0.09 in the dense cluster and 0.39 in the sparse one. One distance rule cannot fit both.
Explain it simply

Each point has a gap, the distance to its nearest point. In the dense cluster the gaps are tiny, about 0.09. In the sparse cluster they're about four times wider. So a point is odd only compared with the points around it.

40 points: a dense cluster of 24, a sparse cluster of 11 and points 36 to 40 apart. The median nearest gap is 0.09 in the dense cluster and 0.39 in the sparse cluster. Point 40 has a gap of 1.00.

pointslink to a neighbor, distance dneighbors k, k-distance, the 1.5 linereach distance, density and LOFflagged outlier
−3−2−101234−2−1012x₁x₂dense cluster · 24sparse cluster · 11363738394040 points, no labelsnearest gap by group0.050.10.20.512nearest gap g (log scale)dense · 24median 0.09sparse · 11median 0.39outliers · 5median 2.153637383940g(40) = d(40, 10) = 1.00−3−2−101234−2−1012x₁x₂dense cluster · 24sparse cluster · 11363738394040 points, no labelsnearest gap by group0.050.10.20.512nearest gap g (log scale)dense · 24median 0.09sparse · 11median 0.39outliers · 5median 2.153637383940g(40) = d(40, 10) = 1.00
Toy: 4.37's 40 points · 2 clusters · 5 outliers
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
g(p)=min⁡o≠pd(p,o)\sy{g}{data}{g(p)} = \min_{o \ne p} \sy{d}{ink}{d(p, o)}
g(40)=1.00g(40) = 1.00

The gap of a point is the distance to its nearest point.

Common mix-ups

MYTHThe point farthest from its neighbors is the most unusual.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01Is the LOF of dense point 15 near 1 or far above 1?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 2 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.