mlnext.anomaly.recall_anomalies#

mlnext.anomaly.recall_anomalies(y: ndarray, y_hat: ndarray, *, k: float = 0) float[source]#

Calculates the percentage of anomaly segments that are correctly detected. The parameter k [in %] controls how much of a segments needs to be detected for it being counted as detected.

Parameters:
  • y (np.ndarray) – Ground Truth.

  • y_hat (np.ndarray) – Label predictions.

  • k (float) – Percentage ([0, 100]) of points that need to be detected in a segment for it to be counted. For K = 0, then at least one point has to be detected. For K = 100, then every point in the segment has to be correctly detected. Default: 0.

Returns:

Returns the fraction of detected anomaly segments.

Return type:

float