Anomaly detection

Find the points that don't belong. Kinds of anomaly, statistical tests with z-scores and the Mahalanobis distance, distance- and density-based scores (k-NN, LOF), the isolation forest, one-class SVMs, reconstruction error, and how to evaluate a detector when anomalies are rare.

55 min

After this lesson you can

  • Distinguish point, contextual and collective anomalies, and outlier detection from novelty detection
  • Derive why squared Mahalanobis distances of Gaussian data follow a chi-square distribution, and explain masking
  • Compute k-NN distance and local outlier factor scores, and say when local beats global
  • Implement an isolation forest from scratch and explain its anomaly score
  • Evaluate a detector with rare positives using precision-at-k and average precision, not accuracy

In this lesson

  1. What counts as an anomaly
  2. Statistical scores: how many standard deviations?
  3. Distances and local density
  4. Isolation: anomalies are few and different
  5. Four detectors, one dataset
  6. Evaluating a detector when anomalies are rare

This lesson is part of Descent Pro

Descent Pro unlocks every lesson on the route, from base camp to the summit. Every plan starts with a free trial.

Descent Pro

Start your free trial to keep reading

This lesson, and every other lesson on the route, is part of Descent Pro. Every plan starts with a free trial, and students with a .edu email get longer. Cancel before the trial ends and you pay nothing.