Local Outlier Factor (LOF) — how does it work?
mediumAnswer
- For each point, compare its local density (via k-NN distances) to that of its neighbors.
- LOF > 1: point is in a lower-density region than its neighbors → outlier.
- Handles clusters of varying density — a big advantage over global thresholds.
- Cost or O(n log n) with indexes.
- Weakness: sensitive to k.
- Standard in tabular anomaly detection alongside Isolation Forest.
Check yourself — multiple choice
- Random
- Ratio of local density to neighbors' density; LOF > 1 → outlier; handles varying-density clusters; sensitive to k
- Same as k-means
- Not real
LOF: local density ratio vs neighbors; handles varying densities.
#anomaly-detection#density
Practise Unsupervised Learning
214 interview questions in this topic.
Related questions
- Elliptic envelope / robust Mahalanobis distance — when to use?
- Kernel Density Estimation — mechanism.
- What are the main approaches to anomaly detection?
- Gaussian Mixture Model vs k-means — what's the difference?
- HDBSCAN — how does it improve on DBSCAN?
- OPTICS — what does it produce and how do you use it?