Anomaly Detection
Find the rare and the unusual: statistical outliers, distance and density methods, isolation forests, one-class SVMs, autoencoders, fraud with imbalanced data, and explaining why a point was flagged.
Before this: Machine Learning. Deep Learning for the autoencoder step; Time Series & Forecasting helps there too.
-
15 min
Step 1What anomaly detection is
Kinds of anomalies, and why you usually train on mostly normal data.
Introduction to Anomaly Detection for EngineersMATLAB
-
20 min
Step 2Outliers by z-score
Flag points far from the mean, which works best on roughly normal data.
Outlier detection and removal: z score, standard deviation | Feature engineering tutorial python # 3codebasics
-
11 min
Step 3Multivariate outliers with Mahalanobis distance
Distance that accounts for correlation; assumes a roughly elliptical data cloud.
Euclidean distance and the Mahalanobis distance (and the error ellipse)TileStats
-
9 min
Step 4Outliers as DBSCAN noise points
Points in no dense cluster become noise, a simple outlier signal.
Clustering with DBSCAN, Clearly Explained!!!StatQuest with Josh Starmer
-
6 min
Step 5Local outlier factor
Compare a point's density to its neighbors' to find local outliers.
Local Outlier Factor- Everything you need to know! | Outlier Detection| Machine Learning AlgorithmsTrisha Sarkar
-
15 min
Step 6Isolation forest
Anomalies tend to need fewer random splits to isolate, coded in Python.
Isolation Forest for Outlier Detection within PythonAndy McDonald
yzhao062/pyod★ 10.1k -
6 min
Step 7One-class SVM
Learn a boundary around normal-only data and flag what falls outside it.
One-Class SVM for Outlier DetectionMachineLearningInterview
-
27 min
Step 8LSTM autoencoder for time-series anomalies
Train on normal sequences, then flag windows with high reconstruction error.
180 - LSTM Autoencoder for anomaly detectionDigitalSreeni
-
58 min
Step 9Fraud detection with imbalanced data
Credit card fraud with under 1% positives: resampling and the right metrics.
Credit Card Fraud Detection - Dealing with Imbalanced Datasets in Machine LearningGreg Hogg
-
26 min
Step 10Explain anomalies with SHAP
See which features pushed an isolation forest to flag a point.
Explaining Anomalies with Isolation Forest and SHAP | Python TutorialA Data Odyssey
shap/shap★ 25.9k -
1h 27m
Step 11Where the field stands
A Microsoft Research talk on algorithms, benchmarks, and explaining anomalies.
Anomaly Detection: Algorithms, Explanations, ApplicationsMicrosoft Research
Build it
Watching isn't learning. Pick one and put it on GitHub.
- Compare z-score, LOF, and isolation forest on a public credit card fraud dataset using PR-AUC.
- Build an LSTM autoencoder that flags unusual windows in server CPU or sensor data, and plot the alerts.
- For the top 20 flagged points of any detector, show a SHAP explanation of why each was flagged.