Outlier Analysis
What Is an Outlier?
- An outlier (anomaly) is a data object that deviates so much from other objects that it raises suspicion it was generated by a different mechanism.
- "One person's noise is another's treasure": outliers can be errors to discard or the most valuable signal (fraud, intrusion, fault, rare disease).
- Outlier analysis = finding objects that are markedly dissimilar from the majority.
Categories of Outliers
- Point outliers: a single object anomalous (most common).
- Contextual (conditional) outliers: anomalous only in a specific context (e.g., temperature 35°C is normal in summer but anomalous in winter). Need context attributes + behavioral attributes.
- Collective outliers: a collection of related objects anomalous as a group (e.g., a subsequence of a signal), even if each point alone is normal.
Challenges
- What is "normal" depends on application; outliers are rare ⇒ imbalanced classes.
- High dimensionality makes distance unreliable (concentration of distance).
- Outliers may be the target (fraud) rather than noise to remove.
Approaches Overview
| Approach | Basis | Needs labels? | Strength |
|---|---|---|---|
| Statistical / model-based | parametric/non-parametric distribution | no | principled, interpretable |
| Distance-based | distance to neighbors | no | simple, general |
| Density-based | local density vs neighbors | no | finds local outliers (LOF) |
| Angle-based (ABOD) | variance of angles | no | good in high-D |
| Deviation-based (subspace, HiCS) | high-contrast subspaces | no | high-dim outliers |
| Proximity / clustering by-product | distance to cluster | no | reuses clustering |
1. Statistical (Model-Based) Methods
- Assume data follows a distribution
; flag points with very low probability. - Parametric: e.g., Gaussian — point is outlier if it lies beyond
standard deviations: - Grubbs' test: detects a single outlier maximizing the standardized deviation.
- Non-parametric: use boxplot / IQR rule: outlier if
or . - Histogram / mixture models: fit mixture, low-likelihood points = outliers.
- Limitations: assumes a (often unimodal) distribution; masking (multiple outliers hide each other); struggles in high-D and with multimodal/complex data.
2. Distance-Based Methods (Knorr & Ng)
- An object is an outlier if few points are within distance
(i.e., it is far from most others). - DB(pct, D) outlier: a point
is an outlier if at most pct% of points lie within distance of : - k-NN distance / k-distance: distance to the
-th nearest neighbor; large k-distance ⇒ outlier. A simple, model-free detector. - Nested-loop / cell-based algorithms speed up distance outlier detection.
- Limitations: fails when normal regions have varying density (a sparse-but-normal region looks outlier-ish); distance degrades in high-D (curse of dimensionality).
3. Density-Based: LOF (Local Outlier Factor)
LOF (Breunig et al.) measures outlier-ness by comparing an object's local density to that of its neighbors — detects local outliers that global density/distance miss.
Definitions
- k-distance(p) = distance to the
-th nearest neighbor. - k-distance neighborhood
= points within k-distance of (includes ties). - Reachability distance:
(smooths small fluctuations; never below 's k-distance). - Local reachability density (LRD) of
: Higher LRD ⇒ denser neighborhood. - Local Outlier Factor:
: similar density to neighbors ⇒ normal. : sparser than neighbors ⇒ local outlier. : denser than neighbors (insider).
Properties
- Detects local outliers (a point can be an outlier even inside a globally dense region if it is sparser than its local surroundings).
- Choice of
matters (too small → unstable, too large → global measure). - Variants: LOCI, COF (connectivity-based), INFLO (using reverse k-NN), LoOP (local probability).
| Method | Detects | Weakness |
|---|---|---|
| Statistical | global, distributional | assumes distribution |
| Distance (k-dist) | far-from-all | uniform-density assumption |
| LOF | local density | needs |
4. Angle-Based: ABOD (Angle-Based Outlier Degree)
- In high-D, distance concentrates, so use angles instead. An outlier has high variance of angles to other points (its neighbors lie in a narrow cone vs. spread out for normal points).
- ABOD: variance of
-angle between vectors to pairs of other points; high variance ⇒ outlier. - More robust in high dimensions than distance/LOF; variants FastABOD sample points for efficiency.
5. High-Dimensional: Subspace / Deviation (HiCS)
- Global distance fails in high-D because all pairwise distances become similar (concentration of distance).
- Outliers often appear only in a subset of dimensions (subspace).
- Subspace outlier detection: search subspaces where a point is anomalous.
- Feature bagging / outlier ensembles: run a detector on many random subspaces and aggregate scores.
- HiCS (Highest Contrast Subspaces): identifies subspaces with high contrast (where the point's local density is much lower than expected from marginal distributions). Uses the contrast
; low ⇒ outlier in that subspace.
- Grid-based / projected outlier methods (e.g., on CLIQUE dense cells) find deviations in subspaces.
6. Clustering-Based (By-Product) Outliers
- Run a clustering algorithm (k-means, DBSCAN); objects far from any centroid / labeled NOISE are outliers.
- Simple, reuses existing pipeline, but depends on clustering quality.
7. Deviation-Based & Time-Series Outliers
- Sequential / transform: Fourier, wavelets to find anomalies in signals.
- Markov / HMM models for sequence anomalies; distance to nearest neighbor in time series.
Statistical Method — Worked Example
Heights (cm) of 10 people:
- For 200:
— above a typical or even threshold ⇒ candidate outlier, but note itself inflates (masking). A robust approach (median=169.5, MAD≈5.2) gives modified ⇒ clearly an outlier. - Boxplot rule: Q1=165, Q3=172, IQR=7 ⇒ upper fence
; 200 > 182.5 ⇒ outlier. Lower fence (none below).
Distance-Based — Worked Example
Points in 2-D:
- A,B,C each have 2 neighbors within 2 ⇒ normal.
- D has 0 neighbors within 2 ⇒ outlier by DB(10%, 2). This matches intuition; but if the normal cluster were itself sparse (points 5 apart), distance alone would falsely flag them.
LOF — Worked Example
Consider
Choosing k for LOF
- Small
(e.g., 5–10): captures fine local structure but noisy. - Large
: LOF approaches a global measure (loses locality). - Practical: try several
, look for points consistently with high LOF.
HiCS / Subspace Outliers (Detail)
- In
dimensions, the expected distance to the -th neighbor concentrates around a constant for all points ⇒ distance/LOF lose power. - HiCS searches subspaces where a point's contrast
is very small (its local density in that subspace is far below what marginals predict) — i.e., it is anomalous only along those dimensions. - Outlier ensembles (e.g., feature-bagging): run a base detector on many random subspaces, average scores ⇒ robust to irrelevant dimensions and the curse of dimensionality.
Model-Based & Time-Series Outliers (More)
- Autoencoder / reconstruction error: train a neural net to reconstruct normal data; high reconstruction error ⇒ outlier (great for high-D/images).
- One-Class SVM: learns a boundary around normal data in feature space; points outside ⇒ outliers.
- Time series: window + z-score, Seasonal-Hybrid ESD, or compare to forecast (ARIMA) residuals.
Method Selection Guide
| Data characteristic | Recommended |
|---|---|
| clean parametric, low-D | statistical (z / boxplot) |
| general, uniform density | distance (k-dist) |
| varying density, local | LOF / LoOP |
| high-dimensional | ABOD / subspace (HiCS) / ensemble |
| streaming | incremental / windowed |
| need probability | One-Class SVM / GMM |
Evaluating Outlier Detectors
- Unsupervised detectors have no ground truth; rank outputs and inspect top scores (human-in-the-loop).
- With labels, use Precision@k (fraction of true outliers among top-
flagged), ROC-AUC on the outlier-score ranking, or Recall at a fixed alert budget. - Compare methods by AUC; beware that a method tuned to one data type may fail on another (use the selection guide below).
Real-World Applications
- Fraud detection: credit-card transactions, insurance claims, click fraud.
- Intrusion / anomaly detection: network traffic, system logs, IoT sensors.
- Fault / predictive maintenance: vibration, temperature deviations.
- Medical: rare diseases, adverse drug reactions.
- Data cleaning: duplicate / entry-error detection as a by-product.
Method Selection (Recap)
- clean parametric, low-D → statistical.
- general, uniform density → distance (k-dist).
- varying density / local → LOF, LoOP.
- high-dimensional → ABOD, subspace (HiCS), ensembles, autoencoders.
- need probability bound → One-Class SVM, GMM.
Contextual (Conditional) Outliers — Worked
Temperature 35°C is normal in summer but anomalous in winter. Model the context (season) separately, then detect deviation within that context:
Collective Outliers
A set of points each "normal" alone but anomalous together — e.g., a sustained low-amplitude oscillation in a sensor, or a burst of otherwise-normal transactions forming a fraud pattern. Detect via sequence models (HMM, Markov), window statistics, or collective/subspace deviation methods.
Outlier Detection Pipeline
- Profile "normal" (distribution, density, or model).
- Score every object by deviation from normal.
- Rank; alert top-
or those above threshold. - Validate (human / labels) and tune parameters (
).
Summary
Outliers are objects generated by a different mechanism; they may be noise or the key finding (fraud, faults). Point / contextual / collective are the three kinds. Statistical methods flag low-probability points under an assumed distribution (masking & high-D are weaknesses). Distance-based (DB(pct,D), k-distance) flag far-from-most points but assume uniform density. Density-based LOF compares local reachability density to neighbors, catching local outliers via