Skip to main content

find_anomalous_rows

Function find_anomalous_rows 

Source
pub fn find_anomalous_rows(
    baseline: &[Precision],
    current: &[Precision],
    k: usize,
) -> Vec<AnomalyRow>
Expand description

Return the k rows whose current value diverged most from baseline.

Result is sorted by descending anomaly score (largest first). Ties are broken by row index ascending so the API is deterministic.

  • O(n log k) time, O(k) space.
  • If k >= baseline.len(), returns all rows sorted by anomaly.
  • If k == 0, returns an empty vector.

Panics if baseline.len() != current.len().