liveBook · Manning

Subspace outlier detection

As explained in Outlier Detection in Python

SOD is a subspace-based outlier detection algorithm that identifies observations anomalous in selected feature subsets.

Subspace outlier detection (SOD) finds observations that are unusual in a small, relevant subset of features rather than across the full feature space. This helps when additional dimensions obscure an anomaly or introduce irrelevant variation. section 6.10

For each point, SOD builds a reference set of neighbors using shared nearest neighbors (SNN): points generated by the same mechanism should share many neighbors, even when Euclidean distance is unreliable in high-dimensional data. section 6.10

Figure 6.14 The left pane shows point A in a 2D dataspace. The point is unusual considering feature A but not if using Euclidean distances in the full 2D dataspace. Using additional features can be counterproductive. In the middle and right panes, we see another point, point B, which is an outlier in the C–D subspace but not in the E–F subspace. We need only features C and D to identify this outlier.

A two-dimensional example shows why a point can be anomalous in one feature while appearing typical in a larger space, and why another anomaly may depend specifically on the C–D subspace. section 6.10

Detecting an injected relationship anomaly

A 100-by-35 synthetic dataset makes features 8 and 9 related, then inserts an unusual point with values 3.5 and −3.8 in those features. PyOD's SOD, configured with ref_set=3 and contamination=0.01, ranks that otherwise typical point as the top outlier. section 6.10

How Outlier Detection in Python covers it

How deep it goes
Explains subspace motivation, SNN reference sets, and a PyOD test, but defers broader algorithmic detail.
Examples
Uses two subspace diagrams and a 100-by-35 synthetic dataset with an injected anomaly in features 8 and 9.
What you can do after
Apply it via PyOD's SOD implementation to flag anomalies localized to relevant feature relationships.
How it connects
Connects SOD with KNN, LOF, shared nearest neighbors, FeatureBagging, 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.