For anomaly detection with machine learning on operational and sensor data, start simple. Independent benchmarks found statistical methods performing best on univariate data, and no method family outperforming the others on multivariate data. Deep models showed an edge only in narrower conditions: contextual anomalies (on one of five datasets), large datasets, and some multivariate cases. Two engineering problems sit after the choice of algorithm: evaluating a detector honestly when true anomalies are rare, and setting a threshold that does not bury the on-call engineer in false alarms.
If you want the grounding first (what a detector scores, and how a score becomes an alert), our grounded guide to anomaly detection for operations teams covers it. The sections below assume that grounding and go straight to the choices.
Choosing a Method for Anomaly Detection with Machine Learning: A Decision Table
The table is a starting point, ordered by what the data and the anomaly look like rather than by algorithm fashion. Each row is argued in the sections that follow.
| Your situation | Start with | Why |
|---|---|---|
| Univariate metric; anomalies are values clearly outside the normal range (point anomalies) | A threshold, quantile rule or simple statistical model (AR, MA, ESD) | Statistical methods performed best on point and collective anomalies in univariate benchmarks, at a fraction of the compute |
| The value is normal, but wrong for its time or context (contextual anomalies) | A seasonal or forecasting baseline first; a neural sequence model if that fails | On the one contextual-anomaly dataset in each benchmark, statistical models struggled and neural networks scored notably higher |
| Multivariate data, modest training history | Conventional methods: vector autoregression, k-means on windows | Conventional methods outperformed ML and deep families on small training sets; k-means on windows proved very effective on multivariate series |
| Multivariate data, large history, strong cross-sensor dependencies | Deep models (autoencoders, LSTM, graph networks), benchmarked against a classical baseline | Deep models were the more practical choice at scale in benchmarks; surveys recommend graph networks for complex inter-signal dependencies |
| Only clean “normal” data is available for training | Novelty detection (semi-supervised): one-class models, forecasting or reconstruction models | These approaches learn normal behaviour and flag deviation from it |
| Behaviour drifts over time (seasonality, wear, configuration changes) | Any of the above with scheduled retraining and a threshold recomputed from recent data | Non-stationary data needs online or incremental model updates |
Is a Simple Threshold Rule Still Enough for Our Metrics?
Often, yes, and benchmark evidence backs that. A point anomaly is a value that deviates sharply from the rest of the data, while a contextual anomaly sits inside the normal range but is wrong for its context, such as a time window. A fixed threshold or quantile rule handles the first kind well and is blind to the second by construction.
Wu and Keogh’s 2021 analysis of the public benchmarks makes the point bluntly. They found that 316 of the 367 series in the Yahoo benchmark (86.1%) could be solved with a single line of basic MATLAB code, and more than half could be solved with an individually chosen threshold constant. A 2025 position paper on anomaly-detection benchmarking ran a deliberately trivial “Quantiles” detector, which scores each observation by the fraction of features below the 5% or above the 95% quantile of the training data. It ranked second among the compared methods and was not statistically different from them, while failing on cases such as anomalies inside a ring of normal points.
The Google SRE book describes a trend towards simpler monitoring, avoiding “magic” systems that try to learn thresholds, and insists that rules which page a human should be simple to understand and represent a clear failure. A 2025 industry perspective on time-series anomaly detection adds that a rule like “two standard deviations from the mean” is easy to explain and to draw on a chart.
The rule stops being enough when context decides what is abnormal. That same industry paper gives the example of zero sales on a public holiday: statistically anomalous, operationally expected, and only distinguishable with external knowledge. Our view is that the next step after a static threshold is a seasonal or forecasting baseline that knows what “normal for this hour” looks like, not a jump straight to deep learning.
Isolation Forest, LOF, One-Class SVM and Clustering: What Each One Assumes
Before choosing among classical detectors, settle whether you are doing outlier detection or novelty detection. The scikit-learn documentation draws the line clearly: outlier detection trains on data that already contains outliers and tries to fit where the data is concentrated, while novelty detection trains on clean data and asks whether a new observation differs from it. The first is unsupervised anomaly detection, the second semi-supervised.
Isolation Forest and Its Contamination Parameter
Isolation forest builds random trees that split on a randomly chosen feature at a random value; anomalies need fewer splits to isolate, so a short average path length signals abnormality. Many implementations, including scikit-learn’s, expose a contamination parameter that declares the expected proportion of anomalies and thereby sets the decision threshold, and Braei and Wagner’s 2020 survey warns that setting it wrongly raises either false positives or false negatives. LOF in scikit-learn works the same way: contamination sets the threshold as a percentile of the training scores.
This is easy to miss. Contamination is not a model hyperparameter you tune for accuracy and forget; it is a statement about how often the system should alert, and it belongs in the same conversation as on-call capacity. On time series, the sliding-window length is the other lever, since windows that are too short lack data and windows that are too long weight stale behaviour as heavily as recent behaviour. Isolation forest also has a cost: in Braei and Wagner’s univariate comparison it reached a very high AUC but needed about a thousand times more time for training and inference than the AR and MA models.
LOF, One-Class SVM and Clustering
Local Outlier Factor compares a point’s local density with that of its neighbours and flags points that are much sparser than their surroundings. That makes it a natural fit where anomalies are local rather than global.
One-class SVM learns a boundary around the training data and labels points outside it as anomalous. The scikit-learn documentation notes that it is sensitive to outliers in the training data and so does not perform well for outlier detection, and a deep anomaly detection review adds that one-class models can struggle when the normal class itself has a complex distribution. In practice that points one-class SVM towards novelty detection on clean, fairly homogeneous normal data.
Clustering approaches score each window by its distance to the nearest cluster centre. A 2024 decade review notes that this straightforward k-means approach has proven very effective on multivariate time series. DBSCAN needs a neighbourhood radius and a minimum cluster size, and choosing those well is the main difficulty. Clustering detectors share a weakness: anomalies in the training data can bias the clusters themselves.
One preprocessing trap applies to all of these. The 2025 benchmarking position paper points out that min-max scaling and z-score standardisation compress exactly the extreme values detectors rely on, and that median-and-MAD standardisation preserves that structure.
How Do Machine Learning Methods Detect Anomalies in Multivariate Sensor and Metric Streams?
Prediction-based detectors come in two groups: forecasting-based and reconstruction-based. A forecasting model predicts the next point or window from recent history and treats the prediction error as the anomaly score. Any regression model can play that role, and the classical multivariate version is vector autoregression, which explains each variable by its own past and the past of the others. Forecasting detectors suit streaming because they predict before the data arrives, but they degrade on series that change rapidly and unpredictably.
A reconstruction model, typically an autoencoder, compresses a window into a low-dimensional representation and rebuilds it; windows that reconstruct badly are anomalous. The Darban et al. survey of deep time-series anomaly detection notes that reconstruction models see the current data, which can make them more accurate at the cost of some detection delay. Both families rest on the same assumption: the model learns normal behaviour well because the training data contains few or no anomalies. Autoencoders break that assumption quietly, because they can learn to reconstruct noise and anomalies present in training, which shrinks the very errors you are trying to detect.
Real-world time-series data is inherently non-stationary. The Darban et al. survey argues that changing distributions require online or incremental training, and a 2023 study of streaming autoencoders lists seasonality, incipient faults and behavioural change as common causes of concept drift. In that study the anomaly threshold was recomputed as a percentile of recent reconstruction losses at every model update. Adding explicit drift detection improved performance after drift, although on milder drift the simpler incremental variants and an incremental isolation forest did better. How often you retrain is itself a trade-off between compute cost and overfitting.
Energy and industrial telemetry has its own signal patterns; how detection plays out there is covered in how anomaly detection works in industrial and energy operations. The monitoring a deployed model needs to catch its own drift is a separate design question, set out in what drift telemetry an anomaly system needs beyond a classical model.
When Does Deep Learning Earn Its Extra Cost over Classical Anomaly Detection Algorithms?
Deep learning earns its cost when anomalies are contextual or training data is plentiful; elsewhere the measured evidence does not support it as the default.
Braei and Wagner’s 2020 comparison of 20 methods found that four of the five best performers were statistical and four of the worst were deep learning. The exception was a dataset dominated by contextual anomalies, where statistical models overfitted and neural networks reached higher AUC. Even there, LSTM and GRU models carried inference times above almost all machine learning approaches. The 2024 benchmark “Benchmarking Anomaly Detection Algorithms: Deep Learning and Beyond” found tree-based evolutionary algorithms matching or beating deep learning on small univariate datasets with fewer than 10% anomalies, and catching singleton anomalies the deep models missed.
On multivariate data, the evidence is mixed. Audibert et al. (Pattern Recognition, 2022) compared sixteen conventional, machine learning and deep methods on five real datasets and found that no family outperformed the others. Deep methods were clearly better only on WADI, the dataset with contextual anomalies. When the training set was small, conventional methods won; when data was large, some conventional methods failed to converge, which made deep models the more practical choice at that scale. The TSB-AD benchmark (NeurIPS 2024), covering 1,070 series from 40 datasets and 40 algorithms under a unified tuning setup, found simpler architectures and statistical methods often performing better, while flagging neural networks as promising on multivariate cases.
The sources do not all agree. The Darban et al. survey states that many deep models deliver significantly higher performance than traditional methods in real-world applications. We weigh the independent benchmarks more heavily, because TSB-AD tunes every method under one unified setup, while Wu and Keogh, and Kim et al., showed common benchmarks and protocols to be flawed. Wu and Keogh themselves say they know of no paper with forceful, reproducible evidence that deep learning beats much simpler methods.
Cost is not only accuracy. Deep models concentrate their cost in training, though some can be faster at inference, recurrent LSTM and GRU models excepted, and they are harder to reproduce because open, working implementations are scarcer. No single detector wins on every dataset, and performing well on one dataset is not enough to declare a method useful. The economics of that decision in industrial settings are worked through in when AI-driven operational anomaly detection earns its cost.
How Should We Evaluate a Detector When Real Anomalies Are This Rare?
Do not use accuracy. When anomalies make up under 1% of the data, a classifier that labels everything normal scores above 99% accuracy, which is why a 2023 taxonomy of 20 evaluation metrics says accuracy should not be used for anomaly detection at all.
Precision tells you how many alerts were real and recall how many real events you caught; low precision means false alarms, low recall means missed events. The F-beta score lets you weight one against the other explicitly. For threshold-free comparison, precision-recall curves are more informative than ROC curves on imbalanced data. The 2025 benchmarking position paper frames the choice by consequence: PR-AUC penalises high-confidence false positives and suits cases where false alarms are costly, while ROC-AUC suits cases where a missed anomaly is the primary risk. ROC-AUC also counts true negatives, so its score rises as the anomaly ratio falls, making precise detection count for less. TSB-AD identified VUS-PR as the most reliable measure for time-series detection.
Several protocol choices inflate results. Kim et al. (AAAI 2022) showed that point adjustment, which marks a whole anomalous segment as detected if any point in it fires, can make even a random score look state of the art. They also showed an untrained model performing comparably to published methods without point adjustment. The 2023 metric taxonomy found that metric choice alone has a large impact on how methods rank. Random train-test splits and k-fold cross-validation are unreliable at low anomaly ratios because a split can miss entire anomaly types.
Time matters too. Lavin and Ahmad’s Numenta Anomaly Benchmark (2015) was built on the argument that standard precision and recall ignore the value of early detection and that batch train-test splits misrepresent streaming. It scores with application profiles that weight false positives or false negatives more heavily. The 2025 industry perspective adds that alerting needs streaming evaluation, scoring each point using only data seen before it, whereas benchmarks often use an ideal threshold chosen with the full series and the ground truth.
Evaluation Checklist Before Trusting a Detector
- The headline metric is VUS-PR, which TSB-AD found most reliable, not accuracy.
- No point adjustment, or results are reported both with and without it.
- Scoring uses only data seen before each point, as streaming evaluation requires.
- Every anomaly type you care about appears in the test window, since random splits can drop rare types.
- The threshold was set without looking at test labels, as it would be in production.
- Time-to-detect is measured alongside precision and recall where early warning matters.
- Results are on your own labelled incidents, not only on Yahoo, Numenta, NASA or OMNI, which Wu and Keogh found mislabelled and irretrievably flawed.
Setting a Threshold the On-Call Engineer Can Live With
The threshold decides whether a human gets paged, which makes it a critical parameter and one research often treats as a side issue. The industry perspective is candid that, given the usually unsupervised nature of the problem, it is unclear how to set a threshold effectively even with human input.
A static percentile of the training error is the simplest: Braei and Wagner set thresholds as a percentile of the prediction-error distribution, and the industry paper’s worked example thresholds spectral-residual scores at the 99.9th percentile. Nonparametric dynamic thresholding, introduced by Hundman et al. (KDD 2018) for spacecraft telemetry, picks the threshold whose removal most reduces the mean and spread of the scores, and came with explicit false-positive mitigation strategies. Peaks-over-threshold methods fit a generalised Pareto distribution to the tail of the score distribution, an extreme-value approach. Static thresholds also go stale under drift, and anomalies that sit close to normal behaviour may never cross them.
On the Yahoo data the authors report F1 of 0.045 for an optimal static threshold and 0.118 for the extreme-value DSPOT method, against 0.952 for their own approach. Read that with care: it is the authors’ own method, the Yahoo benchmark is one Wu and Keogh judged flawed, and the authors note weaker performance on isolated point anomalies. The durable lesson is narrower and more useful: the same detector can look useless or excellent depending on how its scores are cut.
The cost of a bad threshold lands on the on-call engineer. The Google SRE book is explicit that paging a human interrupts their work, personal time or sleep, and that when pages come too often people skim or ignore them, sometimes missing a real page hidden in the noise. The 2025 industry perspective says the same about operators: an alerting feature with a high false-positive rate is likely to be ignored soon. Google’s own Bigtable team once had alerts firing so voluminously that they missed problems affecting users, and recovered by relaxing the target and disabling email alerts. A detector that flags more points tends to raise more false positives: on the Numenta benchmark, the detector that flagged the most points dropped furthest when false positives were penalised.
Alert quality, false-positive economics and missed-event management are production reliability problems in their own right, distinct from model accuracy: a detector can score well offline and still fail its operators through alert fatigue or silent drift after an update. The artefacts that catch those failures are task-specific evaluation harnesses, regression suites, drift detection and alert-quality review, and we treat them as MLOps engineering deliverables, not dashboards. What those artefacts look like for an anomaly system is laid out in the artefacts that make an anomaly detection system trustworthy.
The Ratio That Should Drive Every Choice Above
Every decision on this page, from algorithm to metric to threshold, comes back to one number your team has to estimate for its own system: what a false page costs relative to a missed event. If a missed anomaly is the primary risk, ROC-AUC fits; if false alarms are costly, PR-AUC fits, and NAB-style profiles make that trade-off explicit in the score itself. Settle that ratio before comparing algorithms, because the benchmarks show that metric choice has a large impact on how methods rank.