19 releases (6 breaking)

new 0.8.1 Jan 7, 2025
0.8.0 Dec 23, 2024
0.7.0 Nov 25, 2024
0.6.3 Nov 20, 2024
0.2.0 Jun 5, 2024

#239 in Math

Download history 6/week @ 2024-09-20 4/week @ 2024-09-27 6/week @ 2024-10-04 391/week @ 2024-10-11 485/week @ 2024-10-18 402/week @ 2024-10-25 76/week @ 2024-11-01 348/week @ 2024-11-08 170/week @ 2024-11-15 209/week @ 2024-11-22 25/week @ 2024-11-29 23/week @ 2024-12-06 12/week @ 2024-12-13 128/week @ 2024-12-20 22/week @ 2024-12-27 81/week @ 2025-01-03

255 downloads per month
Used in augurs

MIT/Apache

90KB
2.5K SLoC

Outlier detection

This crate provides implementations of time series outlier detection, the problem of determining whether one time series behaves differently to others in a group. (This is different to anomaly detection, which aims to determine if one or more samples appears to be different within a time series).

Two implementations are planned:

  • DBSCAN: implemented
  • Median Absolute Difference (MAD): not yet implemented (see GitHub issue)

Example

use augurs::outlier::{OutlierDetector, DbscanDetector};

// Each slice inside `data` is a time series.
// The third one behaves differently at indexes 2 and 3.
let data: &[&[f64]] = &[
    &[1.0, 2.0, 1.5, 2.3],
    &[1.9, 2.2, 1.2, 2.4],
    &[1.5, 2.1, 6.4, 8.5],
];
let detector = DbscanDetector::with_sensitivity(0.5)
    .expect("sensitivity is between 0.0 and 1.0");
let processed = detector.preprocess(data)
    .expect("input data is valid");
let outliers = detector.detect(&processed)
    .expect("detection succeeds");

assert_eq!(outliers.outlying_series.len(), 1);
assert!(outliers.outlying_series.contains(&2));
assert!(outliers.series_results[2].is_outlier);
assert_eq!(outliers.series_results[2].scores, vec![0.0, 0.0, 1.0, 1.0]);

Dependencies

~6MB
~119K SLoC