Detectors¶
PySAD has 16 streaming 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: |
|
Time-decayed counts of random subspace grids [SA16] |
The range of each feature |
Fixed: |
|
Isolation Forest on a sliding window [DF13] |
Nothing (initial points optional) |
Fixed: two windows of |
|
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 |
|
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 |
Univariate detectors¶
These detectors take points with exactly one feature. Give each value as an array of shape (1,).
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 in standard deviations [HVK17] |
Nothing |
Fixed with the default mean. Grows with |
|
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 × |
|
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 |
PyOD 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. |
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. |