STRAY
STRAY: robust anomaly detection in data streams with concept drift.
This is based on STRAY (Search TRace AnomalY) _[1], which is a modification of HDoutliers _[2]. HDoutliers is a powerful algorithm for the detection of anomalous observations in a dataset, which has (among other advantages) the ability to detect clusters of outliers in multi-dimensional data without requiring a model of the typical behavior of the system. However, it suffers from some limitations that affect its accuracy. STRAY is an extension of HDoutliers that uses extreme value theory for the anomalous threshold calculation, to deal with data streams that exhibit non-stationary behavior.
Schnellstart
from sktime.detection.stray import STRAY
estimator = STRAY(alpha: float=0.01, k: int=10, knn_algorithm: str='brute', p: float=0.5, size_threshold: int=50, outlier_tail: str='max')Parameter(6)
- alphafloat, optional (default=0.01)
- Threshold for determining the cutoff for outliers. Observations are considered outliers if they fall in the (1 - alpha) tail of the distribution of the nearest-neighbor distances between exemplars.
- kint, optional (default=10)
- Number of neighbours considered.
- knn_algorithmstr {“auto”, “ball_tree”, “kd_tree”, “brute”}, optional
- (default=”brute”) Algorithm used to compute the nearest neighbors, from sklearn.neighbors.NearestNeighbors
- pfloat, optional (default=0.5)
- Proportion of possible candidates for outliers. This defines the starting point for the bottom up searching algorithm.
- size_thresholdint, optional (default=50)
- Sample size to calculate an empirical threshold.
- outlier_tailstr {“min”, “max”}, optional (default=”max”)
- Direction of the outlier tail.
Beispiele
>>> from sktime.detection.stray import STRAY
>>> from sktime.datasets import load_airline
>>> from sklearn.preprocessing import MinMaxScaler
>>> import numpy as np
>>> X = load_airline (). to_frame (). to_numpy ()
>>> scaler = MinMaxScaler ()
>>> X = scaler. fit_transform (X)
>>> model = STRAY (k = 3)
>>> y = model. fit_transform (X)
>>> y [: 5 ] array([False, False, False, False, False])Referenzen
Talagala, Priyanga Dilini, Rob J. Hyndman, and Kate Smith-Miles.
“Anomaly detection in high-dimensional data.” Journal of Computational and Graphical Statistics 30.2 (2021): 360-374... [R3e8206faf7f3-2] Wilkinson, Leland. “Visualizing big data outliers through distributed aggregation.” IEEE transactions on visualization and computer graphics 24.1 (2017): 256-266.