EventWiseRecall
- class dtaianomaly.evaluation.EventWiseRecall[source]
Compute the Event-Wise Recall score [9].
Recall measures the model’s ability to correctly identify all actual anomalies. For the Event-Wise Recall, the true positives and false negatives are considered at the event-level:
\(TP_e\): the number of ground truth anomalous events that fully or partially overlap with a detected segment.
\(FN_e\): the number of ground truth anomalous events that do not overlap with a detected segment.
We then compute the Event-Wise Recall as:
\[\text{Event-Wise Recall} = \frac{TP_e}{TP_e + FN_e}\]See also
EventWisePrecisionCompute the event-wise Precision score.
EventWiseFBetaCompute the event-wise \(F_\beta\) score.
Examples
>>> from dtaianomaly.evaluation import EventWiseRecall >>> metric = EventWiseRecall() >>> y_true = [0, 0, 0, 1, 1, 0, 0, 0] >>> y_pred = [1, 0, 0, 1, 1, 1, 0, 0] >>> metric.compute(y_true, y_pred) 1.0
- compute(y_true: ndarray, y_pred: ndarray, **kwargs) float
Compute the performance score.
Evaluate how closely the given anomaly scores align to the ground truth anomaly scores.
- Parameters:
- y_truearray-like of shape (n_samples)
Ground-truth labels.
- y_predarray-like of shape (n_samples)
Predicted anomaly scores.
- **kwargs
Additional arguments used for computing the evaluation metric.
- Returns:
- float
The alignment score of the given ground truth and prediction, according to this score.
- Raises:
- ValueError
When inputs are not numeric “array-like”s
- ValueError
If shapes of y_true and y_pred are not of identical shape
- ValueError
If y_true is non-binary.
- ValueError
If y_pred is non-binary.