ArticleslgStudy

computer science

Local outlier factor

Local outlier factor is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Local outlier factor rather than just read about it. In short: In anomaly detection, the local outlier factor (LOF) is an algorithm proposed by Markus M. Breunig, Hans-Peter Kriegel, Raymond T.

Local outlier factor — main illustration
Local outlier factor — illustration

Key takeaways

  • Local outlier factor belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Local outlier factor to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Local outlier factor from memory before moving on to harder problems.

Reference excerpt

In anomaly detection, the local outlier factor (LOF) is an algorithm proposed by Markus M. Breunig, Hans-Peter Kriegel, Raymond T. Ng and Jörg Sander in 2000 for finding anomalous data points by measuring the local deviation of a given data point with respect to its neighbours. LOF shares some concepts with DBSCAN and OPTICS such as the concepts of "core distance" and "reachability distance", which are used for local density estimation.

Basic idea

The local outlier factor is based on a concept of a local density, where locality is given by k nearest neighbors, whose distance is used to estimate the density. By comparing the local density of an object to the local densities of its neighbors, one can identify regions of similar density, and points that have a substantially lower density than their neighbors. These are considered to be outliers. The local density is estimated by the typical distance at which a point can be "reached" from its neighbors. The definition of "reachability distance" used in LOF is an additional measure to produce more stable results within clusters. The "reachability distance" used by LOF has some subtle details that are often found incorrect in secondary sources, e.g., in the textbook of Ethem Alpaydin.

Formal definition Let k -distance ( A ) {\displaystyle k{\text{-distance}}(A)} be the distance of the object A to the k-th nearest neighbor. Note that the set of the k nearest neighbors includes all objects at this distance, which can in the case of a "tie" be more than k objects. We denote the set of k nearest neighbors as N k ( A ) {\displaystyle N_{k}(A)} .

This distance is used to define what is called reachability distance:

reachability-distance k ( A , B ) = max { k -distance ( B ) , d ( A , B ) } {\displaystyle {\text{reachability-distance}}_{k}(A,B)=\max\{k{\text{-distance}}(B),d(A,B)\}}

In words, the reachability distance of an object A from B is the true distance between the two objects, but at least the k -distance {\displaystyle k{\text{-distance}}} of B. Objects that belong to the k nearest neighbors of B (the "core" of B, see DBSCAN cluster analysis) are considered to be equally distant. The reason for this is to reduce the statistical fluctuations between all points A close to B, where increasing the value for k increases the smoothing effect. Note that this is not a distance in the mathematical definition, since it is not symmetric. (While it is a common mistake to always use the k -distance ( A ) {\displaystyle k{\text{-distance}}(A)} , this yields a slightly different method, referred to as Simplified-LOF) The local reachability density of an object A is defined by

lrd k ( A ) := | N k ( A ) | ∑ B ∈ N k ( A ) reachability-distance k ( A , B ) {\displaystyle {\text{lrd}}_{k}(A):={\frac {|N_{k}(A)|}{\sum _{B\in N_{k}(A)}{\text{reachability-distance}}_{k}(A,B)}}}

which is the inverse of the average reachability distance of the object A from its neighbors. Note that it is not the average reachability of the neighbors from A (which by definition would be the k -distance ( A ) {\displaystyle k{\text{-distance}}(A)} ), but the distance at which A can be "reached" from its neighbors. With duplicate points, this value can become infinite. The local reachability densities are then compared with those of the neighbors using

… excerpt ends here. Continue reading the full article.

Illustrations

Local outlier factor: Illustration of the reachability distance. Objects B and C have the same reachability distance (k=3), while D is not a k nearest neighbor.
Illustration of the reachability distance. Objects B and C have the same reachability distance (k=3), while D is not a k nearest neighbor.
Local outlier factor: LOF scores as visualized by ELKI. While the upper right cluster has a comparable density to the outliers close to the bottom left cluster, they are detected correctly.
LOF scores as visualized by ELKI. While the upper right cluster has a comparable density to the outliers close to the bottom left cluster, they are detected correctly.

Worked examples

Example 1 — a first encounter with Local outlier factor

Start with the simplest possible case. Write down what Local outlier factor claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Local outlier factor before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Local outlier factor ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Local outlier factor

In research
Local outlier factor appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Local outlier factor in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Local outlier factor is common in secondary-school and first-year university syllabi. It links to neighbouring topics Data mining, Machine learning algorithms, Statistical outliers, so understanding it makes those chapters shorter.
In everyday life
Look for Local outlier factor outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Local outlier factor in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Local outlier factor means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Local outlier factor out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Local outlier factor in simple terms?

In anomaly detection, the local outlier factor (LOF) is an algorithm proposed by Markus M. Breunig, Hans-Peter Kriegel, Raymond T.

Why does Local outlier factor matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Local outlier factor?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Local outlier factor.

Tags

  • Data mining
  • Machine learning algorithms
  • Statistical outliers

Keep exploring