3 unstable releases

0.3.1 Jul 30, 2024
0.3.0 Jul 30, 2024
0.2.0 Jun 5, 2024

#231 in Math

Download history 145/week @ 2024-05-31 30/week @ 2024-06-07 6/week @ 2024-06-14 1/week @ 2024-06-21 223/week @ 2024-07-26 34/week @ 2024-08-02 2/week @ 2024-08-09 1/week @ 2024-08-16

63 downloads per month

MIT/Apache

86KB
2K 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

~6.5MB
~130K SLoC