segment_anomaly_recall#

segment_anomaly_recall(intervals_true: ArrayLike, intervals_pred: ArrayLike) float[source][source]#

Compute detection recall for segment anomalies.

The fraction of true anomalous intervals that are matched by a predicted anomalous interval (greedy matching). Higher is better.

Returns 1.0 when there are no true intervals (nothing to miss).

Parameters:
intervals_truearray-like of shape (n_true, 2)

True anomalous intervals, as returned by predict_segment_anomalies(). Each row is a [start, end) index pair.

intervals_predarray-like of shape (n_pred, 2)

Predicted anomalous intervals, as returned by predict_segment_anomalies(). Each row is a [start, end) index pair.

Returns:
float

Recall in [0, 1].

Examples

>>> segment_anomaly_recall([[10, 20]], [[12, 22]])
1.0