The arc of the lecture
Anomaly detection — finding the observations that don’t belong — has moved through three broad eras, and the lecture walks all of them in an hour:
- Statistical. Distance from a learned notion of “normal.” The z-score is the canonical tool: flag anything more than k standard deviations out. Simple, fast, and blind to structure — it only sees one dimension at a time, so contextual anomalies (a value that’s fine in isolation but wrong in context) slip through entirely.
- Tree-based. Isolation Forests (Liu, Ting & Zhou, 2008) exploit the defining property of anomalies: they are few and different. Randomly partitioning the data, an anomaly is isolated in far fewer splits than a normal point — so anomaly score becomes average path length through random isolation trees. No distance assumptions, no density estimation, scales to high dimensions.
- Representation-based. Autoencoders learn a compressed representation of “normal” data and measure reconstruction error; a linear autoencoder with MSE loss turns out to recover the same subspace as PCA, which makes it a learned, nonlinear-when-stacked generalization of the classical approach.
The working example
The lecture is anchored on the Kaggle credit-card-fraud dataset: 492 frauds in 284,807 transactions (0.172%), with features V1–V28 already PCA-transformed by the authors — a genuinely extreme class-imbalance case that makes every evaluation choice matter.
What we found at the frontier
The honest ending: the 2024–26 frontier is time-series foundation models (TimeGPT, Chronos, MOIRAI) and LLM zero-shot detectors — but a 2025 study (arXiv 2412.19286) finds classical methods often match or beat them on anomaly detection. The lecture closes on that result rather than the hype: for most tabular problems, a well-tuned Isolation Forest is still the right first answer.
Pre-lecture material
- Reading list: Liu/Ting/Zhou 2008 Isolation Forest (abstract + §§1–2), Chandola/Banerjee/Kumar 2009 survey (§1 only), optionally Goodfellow’s Deep Learning book Ch. 14 on autoencoders.
- Activity notebook (Colab-ready): z-score vs. IsolationForest on synthetic correlated data with 27 planted anomalies — seeded and deterministic. Verified results: the z-score catches 11/27 with zero false alarms but misses all 12 contextual off-band points; iForest catches 24/27 with 4 false alarms. The gap is the lesson.