AnomalyDetection.rs

AnomalyDetection for Rust

Learn how it works

Build Status

Installation

Add this line to your application’s Cargo.toml under [dependencies]:

toml anomaly_detection = "0.1"

Getting Started

Detect anomalies in a time series

```rust let series = vec![ 5.0, 9.0, 2.0, 9.0, 0.0, 6.0, 3.0, 8.0, 5.0, 18.0, 7.0, 8.0, 8.0, 0.0, 2.0, 15.0, 0.0, 5.0, 6.0, 7.0, 3.0, 6.0, 1.0, 4.0, 4.0, 4.0, 30.0, 7.0, 5.0, 8.0 ]; let period = 7; // number of observations in a single period

let res = anomaly_detection::params().fit(&series, period); ```

Get anomalies

rust res.anomalies();

Parameters

Set parameters

rust anomaly_detection::params() .alpha(0.05) // level of statistical significance .max_anoms(0.1) // maximum number of anomalies as percent of data .direction("both") // pos, neg, or both

Credits

This library was ported from the AnomalyDetection R package and is available under the same license.

References

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development:

sh git clone https://github.com/ankane/AnomalyDetection.rs.git cd AnomalyDetection.rs cargo test