Detectors¶
This page lists the input that each detector takes, what it needs before the stream starts and the memory that it keeps. For the parameters, follow the link to the API reference. To choose a detector, see Choose a detector. To compare the results of the multivariate detectors, see the benchmark.
In the memory column, “fixed” means that the memory has an upper limit that does not depend on the length of the stream. A window is the most recent points, up to a fixed number.
Multivariate detectors¶
These detectors take points with one or more features. A feature is one measured value of a point.
Detector |
Method |
Needs before the stream |
Memory |
|---|---|---|---|
Half-space chains on streamhash projections [MLA18] |
Nothing |
Fixed: the chain counts of two windows, and the points of the first window until it is full |
|
Histograms on sparse random projections [Pev16] |
Nothing |
Fixed: |
|
Mass profiles of random half-space trees [TTL11] |
The range of each feature |
Fixed: |
|
Collusive displacement in random cut trees [GMRS16] |
Nothing |
Fixed: |
|
Density of random space trees, scored against the previous window [WZF+14] |
Nothing |
Fixed: |
|
Time-decayed counts of random subspace grids [SA16] |
The range of each feature |
Fixed: |
|
Decayed count-min sketch counts of each feature and of the whole point, in the current time tick against the earlier ticks [BJL+21] |
Nothing |
Fixed: two counts for each of |
|
Count-min sketch counts of each edge |
Nothing |
Fixed: two sketches of |
|
Isolation Forest on a sliding window [DF13] |
Nothing (initial points optional) |
Fixed: two windows of |
|
Online Isolation Forest [LCP+24] |
Nothing |
Fixed: |
|
Gaussian mixture learned by sequentially discounting EM [YTWM00] |
Nothing |
Fixed: |
|
Ensemble of autoencoders [MDES18] |
Nothing |
Fixed. Learns only during its grace periods (1,100 points by default) |
|
Neighbor counts in a sliding window [AF07] |
Nothing |
Fixed: a window of |
|
The neighbor counts of |
Nothing |
Fixed: a window of |
|
The neighbor counts of |
Nothing |
Fixed: a window of |
|
The neighbor counts of |
Nothing |
Fixed: a window of |
|
The neighbor counts of |
Nothing |
Fixed: a window of |
|
Negative number of window points within a radius, estimated from a kernel density over a chain sample of the window [SPP+06] |
Nothing |
Fixed: a window of |
|
The number of neighbors below k that a probe finds when it tests the window newest first and stops at k neighbors [CYW+14] |
Nothing |
Fixed: a window of |
|
Local outlier factor in a sliding window [PLL07] |
Nothing |
Fixed: a window of |
|
Online one-class support vector machine (NORMA) with a Gaussian kernel [KSW04] |
Nothing |
Fixed: the support vectors among the last |
|
The local outlier factor of |
Nothing |
Fixed: a window of at most |
|
How much lower the kernel density at a point is than the densities at its nearest micro-cluster centers in the window (KLOME) [QCRM19] |
Nothing |
Fixed: a window of |
|
Distance to the mean, or Gaussian density, of the closest cluster at the level of a ClusTree that the time budget |
Nothing |
Fixed: a tree of at most |
|
Residual of each point after its projection on a Frequent Directions sketch of the normal points [HK15] |
Nothing (initial points to use a threshold) |
Fixed: a sketch of |
|
Initial points ( |
Fixed: the initial points. Does not learn from the stream |
||
Quantum measurement density estimation [GMBBG22] |
The number of features, the number of random Fourier features ( |
Fixed: a |
|
Eccentricity from the recursive mean and variance [Ang14] |
Nothing |
Fixed: the count, the mean and the variance |
|
Expected similarity: the inner product of each point’s random Fourier features with their running or decaying mean [SER16] |
Nothing |
Fixed: |
Univariate detectors¶
These detectors take points with exactly one feature. Give each value as an array of shape (1,). HTM also takes the time of each value: give each point as the array [timestamp, value].
Detector |
Method |
Needs before the stream |
Memory |
|---|---|---|---|
STL (seasonal-trend decomposition) residuals and a robust generalized ESD (extreme Studentized deviate) test [HVK17] |
The period and the window size |
Fixed: a window of |
|
STL residuals and a generalized ESD test [HVK17] |
The period and the window size |
Fixed: a window of |
|
Distance from the median of the last |
Nothing |
Fixed: a window of |
|
Distance from the running mean or recent median in standard deviations [HVK17] |
|
Fixed; median mode retains only the last |
|
Violations of a confidence band of seasonal deviations around a Holt-Winters forecast, counted in a moving window [Bru00] |
The period |
Fixed: a seasonal coefficient and a deviation for each of the |
|
Logarithmic loss under an autoregressive model that sequentially discounting learning fits, and a second such model on the smoothed losses for change points [TY06] |
Nothing |
Fixed: |
|
The fraction of active columns that the temporal memory of Hierarchical Temporal Memory did not predict, turned into an anomaly likelihood [ALPA17] |
The range of the values ( |
Grows slowly: at most 128 segments of 32 synapses for each of the 65,536 cells, and a window of 8,640 scores |
|
Conformalized k-nearest neighbors [BI16] |
A probationary period: at least 48 values that it learns from before it scores |
Fixed: the last 19 values and about 2 × |
|
Distance from the newest subsequence to its nearest earlier subsequence, the matrix profile of STAMPI [YZU+16] |
The subsequence length ( |
Fixed: the last |
|
Approximate distance from the newest subsequence to its nearest earlier subsequence, exact for each new left-discord, with a backward search that stops early [LWM+22] |
The subsequence length ( |
Fixed: the last |
|
Saliency of the newest value in the spectral residual of a sliding window, with estimated values after it [RXW+19] |
The window size |
Fixed: a window of |
|
Relative entropy of windowed histograms [WVC+11] |
The range of the values |
Grows slowly: a window and one histogram for each distinct state of the stream |
|
Distance of the latest subsequence to weighted k-Shape clusters of past subsequences [BPPF21] |
The subsequence length |
Grows slowly: a batch of |
Integrations¶
These wrappers run a batch detector from PyOD on a stream. A batch detector trains on a complete dataset. For instructions, see Run a PyOD model on a stream.
Wrapper |
Behavior |
|---|---|
Trains the detector on a window of recent points and trains it again every |
|
Trains the detector once on initial points and then only scores. |
PredictiveAnomalyDetector scores each value of a univariate stream by its deviation from the one-step forecast of a River forecaster, the plug-in method of EGADS [LAF15]. The forecaster learns each value after the model scores it.
Baselines for testing¶
These models do not detect anomalies. Use them to test a pipeline or as a reference in an evaluation.
Model |
Score |
|---|---|
Always 0.5. |
|
A random value between 0 and 1. |
|
The label of the point (the known answer: anomaly or normal). It gives the best possible result for a metric. |