liveBook · Manning

Density-based outlier detection

As explained in Outlier Detection in Python

A density-based method identifies unusual observations by comparing the density around observations or regions of the data.

Density-based outlier detection identifies observations in sparsely populated regions of feature space. Unlike methods focused on a point’s absolute distance, it estimates how densely neighboring observations are distributed; points in low-density regions receive higher outlier scores. section 3.2.2

Common density estimates include:

  • Multidimensional Gaussian scoring: estimate each feature’s mean and standard deviation, convert values to probabilities, multiply feature probabilities, and flag rows with unusually low resulting probabilities. section 3.2.2

These methods generally require numeric features, numerical encoding for categorical variables, and comparable feature scales through min-max scaling or standardization. Gaussian scoring additionally assumes approximately Gaussian, independent features; multiplying probabilities becomes especially fragile as dimensions increase. section 3.2 section 3.2.2

Robot-navigation sensor data

A two-dimensional KDE of features V6 and V19 can visualize the estimated density, while scikit-learn’s KernelDensity class can score the same observations and highlight the top 30 outliers.

How Outlier Detection in Python covers it

How deep it goes
Explains Gaussian, radius, and KDE scoring with implementations, but defers detailed local outlier factor treatment.
Examples
Uses radius counts on synthetic two-dimensional data and KDE scoring on OpenML wall-robot-navigation features.
What it assumes
Assumes numeric feature handling and basic probability, while teaching density estimation through distances, Gaussian scores, radius counts, and KDE.
What you can do after
Apply density-based detectors by scaling features, estimating density, deriving scores, selecting cutoffs, and visualizing flagged points.
How it connects
Connects density-based detection with distance-based methods, z-scores, radius neighbors, kernel density estimation, and the curse of dimensionality.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Outlier Detection in Python. The section links point to the parts of the book it draws on.