range_roc_vus_score¶
- range_roc_vus_score(y_true: ndarray, y_score: ndarray, max_buffer_size: int = 500) float [source]¶
Compute the range-based ROC VUS score.
Computes the volume under the receiver-operating-characteristic-buffer_size-surface using the range-based TPR and range-based FPR definition from Paparrizos et al. published at VLDB 2022 [1].
For all buffer sizes from 0 to
max_buffer_size
, we first extend the anomaly labels by two slopes ofbuffer_size//2
length on both sides of each anomaly, uniformly sample thresholds from the anomaly score, and then compute the confusion matrix for all thresholds. Using the resulting false positive (FPR) and false positive rates (FPR), we can plot a curve and compute its area.- Parameters:
- y_truenp.ndarray
True binary labels of shape (n_instances,).
- y_scorenp.ndarray
Anomaly scores for each point of the time series of shape (n_instances,).
- max_buffer_sizeint, default=500
Maximum size of the buffer region around an anomaly. We iterate over all buffer sizes from 0 to
may_buffer_size
to create the surface.
- Returns:
- Tuple[float, float]
Range-based PR VUS score.
References
[1]John Paparrizos, Paul Boniol, Themis Palpanas, Ruey S. Tsay, Aaron Elmore, and Michael J. Franklin. Volume Under the Surface: A New Accuracy Evaluation Measure for Time-Series Anomaly Detection. PVLDB, 15(11): 2774 - 2787, 2022. doi:10.14778/3551793.3551830