Explainable Unsupervised Anomaly Detection with Random Forest
Joshua S. Harvey, Joshua Rosaler, Mingshu Li, Dhruv Desai, Dhagash Mehta
TL;DR
The paper tackles the challenge of unsupervised anomaly detection with minimal preprocessing and robust handling of missing data by learning a similarity-preserving distance via a Random Forest trained to discriminate real data from uniformly generated synthetic data over the data bounds ($RF_{uni}$). It introduces GAP proximities as an interpretable distance metric, constructs a hyperparameter-free outlier score based on distances to a central core, and demonstrates superior anomaly detection performance across a large benchmark (ADBench) compared to traditional detectors. Additionally, the work provides locally explainable predictions by linking outlier scores to Random Forest partition structure and counterfactual trajectories, enabling insights into feature-level contributions. The approach yields practical benefits for scalable, preprocessing-light anomaly detection with built-in visualization potential and explainability, while noting limitations related to contamination and potential sensitivity to extreme values.
Abstract
We describe the use of an unsupervised Random Forest for similarity learning and improved unsupervised anomaly detection. By training a Random Forest to discriminate between real data and synthetic data sampled from a uniform distribution over the real data bounds, a distance measure is obtained that anisometrically transforms the data, expanding distances at the boundary of the data manifold. We show that using distances recovered from this transformation improves the accuracy of unsupervised anomaly detection, compared to other commonly used detectors, demonstrated over a large number of benchmark datasets. As well as improved performance, this method has advantages over other unsupervised anomaly detection methods, including minimal requirements for data preprocessing, native handling of missing data, and potential for visualizations. By relating outlier scores to partitions of the Random Forest, we develop a method for locally explainable anomaly predictions in terms of feature importance.
