Skip to contentScholarGate
LibraryBookshelfDeskReview StudioAssistant
Sign in
On this page
IntuitionHow it worksWhen to use itStrengths & limitationsCommon pitfallsApplicationsFrequently asked🔒 Read the full methodSourcesRelated methods
Cite this pageSpotted an issue on this page? Report or suggest a fix →
Home›Machine learning›Local Outlier Factor (LOF)
Machine learning

Local Outlier Factor (LOF)

Local Outlier Factor (LOF): Density-Based Anomaly Detection · Also known as: LOF, local outlier factor, density-based outlier detection, local density deviation

Local Outlier Factor (LOF) is a density-based, unsupervised anomaly detection algorithm introduced by Breunig, Kriegel, Ng, and Sander in 2000. It assigns each data point a continuous outlier score that quantifies how isolated that point is relative to its local neighborhood, enabling detection of anomalies that global methods miss because they blend into dense clusters elsewhere in the space.

ScholarGate
  1. Machine learning
  2. v1
  3. 3 Sources
  4. PUBLISHED
Cite this page →
Tools & resources
Download slides
Learn & explore

Read the full method

Members only

Sign in with a free account to read this section.

Sign in

Method map

The neighbourhood of related methods — select a node to explore.

Local Outlier Factor
AutoencoderDBSCANIsolation ForestOne-class SVMExplainable One-Class SVMOnline One-class SVMSelf-supervised Isolatio…Semi-supervised Isolatio…

When to use it

LOF is appropriate when anomalies are expected to occur in clusters of varying density and when a global distance threshold would either miss outliers hidden in sparse regions or incorrectly flag points in legitimately sparse but consistent clusters. It works on any continuous feature space with a meaningful distance metric and does not require labeled anomaly examples (fully unsupervised). It suits applications such as fraud detection, network intrusion detection, manufacturing quality control, and medical anomaly screening. The main assumptions are that inliers form reasonably cohesive local neighborhoods and that meaningful pairwise distances can be computed. LOF performs best when n is at least in the tens to low hundreds; for very high-dimensional data (the curse of dimensionality) distances become less discriminative and dimensionality reduction or feature selection is advisable first.

Strengths & limitations

Strengths
  • Detects local outliers in datasets with clusters of varying density, where global methods fail.
  • Produces a continuous, interpretable score rather than a hard binary label, allowing flexible threshold choice.
  • Fully unsupervised: no labeled anomaly data are required.
  • Applicable to any feature space with a computable distance metric, including non-Euclidean distances.
  • Robust to the scale of individual features when distances are computed on standardized data.
Limitations
  • Quadratic time complexity in the naive implementation makes it slow on large datasets without approximate nearest-neighbor indexing.
  • Sensitive to the choice of k: too small a k yields noisy scores; too large a k blurs local structure.
  • Performance degrades in very high-dimensional spaces due to the curse of dimensionality.
  • Does not scale naturally to streaming or online data without recomputation.
  • Provides no model that can be directly applied to score new points without access to the training set.

Frequently asked

How do I choose the right value of k?

There is no universally optimal k. Common practice is to evaluate a range of values — typically 5 to 50 — and inspect how the score distribution and flagged outliers change. A sensitivity analysis across k values gives confidence that detected anomalies are robust to the choice. Domain knowledge about the minimum expected cluster size can also guide the lower bound.

What does a LOF score of 1 versus 3 mean?

A score close to 1 means the point has roughly the same local density as its neighbors and is considered an inlier. A score significantly greater than 1 — often interpreted as above 1.5 or 2 depending on the dataset — indicates that the point's neighborhood is much sparser than its neighbors' neighborhoods. There is no universal cutoff; the threshold should be chosen by inspecting the distribution of LOF scores for the specific dataset.

Can LOF score new, unseen points without retraining?

LOF is a transductive method: it requires the training set to be present to compute neighborhoods and densities for any new point. To score new observations, the training set must be retained and each new point must be inserted to recompute its k-neighborhood against stored training points. Some implementations offer this functionality, but it differs fundamentally from parametric models that learn a compact scoring function.

How does LOF compare to Isolation Forest for anomaly detection?

LOF uses density estimation based on local neighborhoods and is stronger when anomalies cluster in locally sparse regions of a heterogeneous space. Isolation Forest uses random partitioning and tends to be faster and more scalable to large datasets. For high-dimensional or very large datasets, Isolation Forest is often preferred; for moderate-dimensional data with density variation, LOF frequently offers finer discrimination.

Sources

  1. Breunig, M. M., Kriegel, H.-P., Ng, R. T., & Sander, J. (2000). LOF: Identifying density-based local outliers. Proceedings of the 2000 ACM SIGMOD International Conference on Management of Data, 93–104. DOI: 10.1145/335191.335388 ↗
  2. Aggarwal, C. C. (2017). Outlier Analysis (2nd ed., Ch. 4). Springer. ISBN: 978-3-319-47577-6
  3. Hastie, T., Tibshirani, R., & Friedman, J. (2009). The Elements of Statistical Learning (2nd ed., Ch. 14). Springer. ISBN: 978-0-387-84857-0

How to cite this page

ScholarGate. (2026, June 3). Local Outlier Factor (LOF): Density-Based Anomaly Detection. ScholarGate. https://scholargate.app/en/machine-learning/local-outlier-factor

Related methods

AutoencoderDBSCANIsolation ForestOne-class SVM

Which method?

Set this method beside its closest kin and read them side by side — the library lays the books on the table; the choice is yours.

  • AutoencoderDeep learning↔ compare
  • DBSCANMachine learning↔ compare
  • Isolation ForestMachine learning↔ compare
  • One-class SVMMachine learning↔ compare
Compare side by side →

Referenced by

Explainable One-Class SVMOne-class SVMOnline One-class SVMSelf-supervised Isolation ForestSemi-supervised Isolation Forest

Similar methods

Robust Isolation forestIsolation ForestEnsemble Isolation ForestOnline Isolation ForestOne-class SVMRobust One-class SVMSelf-supervised Isolation ForestDBSCAN

Related reference concepts

Clustering AlgorithmsUnsupervised LearningK-Means ClusteringCluster AnalysisClassification AlgorithmsModel-Based Clustering

Spotted an issue on this page? Report or suggest a fix →

ScholarGate — Local Outlier Factor (Local Outlier Factor (LOF): Density-Based Anomaly Detection). Retrieved 2026-07-21 from https://scholargate.app/en/machine-learning/local-outlier-factor · Dataset: https://doi.org/10.5281/zenodo.20539026
Quick facts
Originator
Breunig, M. M.; Kriegel, H.-P.; Ng, R. T.; Sander, J.
Year
2000
Type
Density-based anomaly detection (unsupervised)
Task
Outlier / anomaly detection
MinSample
20
Related methods
AutoencoderDBSCANIsolation ForestOne-class SVM
ScholarGate

A content-first reference library for research methods — what each one is, how it works, and where it comes from.

Open data (CC-BY)

Explore

  • Library
  • Search the library…
  • Browse by field
  • Fields
  • Journey
  • Compare
  • Which method?

Reference

  • Subjects
  • Atlas
  • Glossary
  • Methodology
  • Philosophy

Your tools

  • Bookshelf
  • Desk
  • Chat

Company

  • About
  • Pricing
  • Contact
  • Suggest a method

Entries are compiled from published sources for reference. Verifying the accuracy and suitability of any information for your own use remains your responsibility.

© 2026 ScholarGate · A research-method reference library
  • Privacy
  • Cookies
  • Terms
  • Delete account