@@ -19,12 +19,14 @@ class ROCKAD(BaseSeriesAnomalyDetector):
19
19
"""
20
20
ROCKET-based Anomaly Detector (ROCKAD).
21
21
22
+ Adapted ROCKAD [1]_ version to detect anomalies on time-points.
22
23
ROCKAD leverages the ROCKET transformation for feature extraction from
23
24
time series data and applies the scikit learn k-nearest neighbors (k-NN)
24
25
approach with bootstrap aggregation for robust anomaly detection.
25
26
After windowing, the data gets transformed into the ROCKET feature space.
26
27
Then the windows are compared based on the feature space by
27
- finding the nearest neighbours.
28
+ finding the nearest neighbours. Whole-series based ROCKAD as proposed in
29
+ [1]_ can be found at aeon/anomaly_detection/whole_series/_rockad.py
28
30
29
31
This class supports both univariate and multivariate time series and
30
32
provides options for normalizing features, applying power transformations,
@@ -53,6 +55,30 @@ class ROCKAD(BaseSeriesAnomalyDetector):
53
55
random_state : int, default=42
54
56
Random seed for reproducibility.
55
57
58
+ References
59
+ ----------
60
+ .. [1] Theissler, A., Wengert, M., Gerschner, F. (2023).
61
+ ROCKAD: Transferring ROCKET to Whole Time Series Anomaly Detection.
62
+ In: Crémilleux, B., Hess, S., Nijssen, S. (eds) Advances in Intelligent
63
+ Data Analysis XXI. IDA 2023. Lecture Notes in Computer Science,
64
+ vol 13876. Springer, Cham. https://doi.org/10.1007/978-3-031-30047-9_33
65
+
66
+ Examples
67
+ --------
68
+ >>> import numpy as np
69
+ >>> from aeon.anomaly_detection.series.distance_based import ROCKAD
70
+ >>> rng = np.random.default_rng(seed=42)
71
+ >>> X_train = rng.normal(loc=0.0, scale=1.0, size=(1000,))
72
+ >>> X_test = rng.normal(loc=0.0, scale=1.0, size=(20,))
73
+ >>> X_test[15:20] -= 5
74
+ >>> detector = ROCKAD(window_size=15,n_estimators=10,n_kernels=10,n_neighbors=3)
75
+ >>> detector.fit(X_train)
76
+ >>> detector.predict(X_test)
77
+ array([0. 0.00554713 0.06990941 0.2288106 0.32382585 0.43652154
78
+ 0.43652154 0.43652154 0.43652154 0.43652154 0.43652154 0.43652154
79
+ 0.43652154 0.43652154 0.43652154 0.52382585 0.65200875 0.80313368
80
+ 0.85194344 1. ])
81
+
56
82
Attributes
57
83
----------
58
84
rocket_transformer_ : Optional[Rocket]
@@ -206,7 +232,7 @@ def _fit_predict(self, X: np.ndarray, y: Optional[np.ndarray] = None) -> np.ndar
206
232
point_anomaly_scores = self ._inner_predict (_X , padding )
207
233
return point_anomaly_scores
208
234
209
- def _inner_predict (self , X : np .ndarray , padding : int ) -> np .ndarray :
235
+ def _inner_predict (self , X : np .ndarray , padding : int ) -> np .ndarray :
210
236
"""
211
237
Predict the anomaly score for each time-point in the input data.
212
238
@@ -253,4 +279,4 @@ def _inner_predict(self, X: np.ndarray, padding: int) -> np.ndarray:
253
279
point_anomaly_scores .max () - point_anomaly_scores .min ()
254
280
)
255
281
256
- return point_anomaly_scores
282
+ return point_anomaly_scores
0 commit comments