8 个版本
0.3.0 | 2023年9月26日 |
---|---|
0.2.3 | 2022年3月19日 |
0.2.2 | 2022年1月4日 |
0.2.1 | 2021年12月16日 |
0.1.2 | 2021年10月18日 |
35 在 #时间序列
每月106 次下载
用于 zbusdg
18KB
246 行
AnomalyDetection.rs
Rust 的时间序列 AnomalyDetection
了解其工作原理 (英文)
安装
将以下行添加到您的应用的 Cargo.toml
文件中的 [dependencies]
anomaly_detection = "0.3"
入门
检测时间序列中的异常
use anomaly_detection::AnomalyDetector;
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 = AnomalyDetector::fit(&series, period).unwrap();
获取异常
res.anomalies();
参数
设置参数
AnomalyDetector::params()
.alpha(0.05) // level of statistical significance
.max_anoms(0.1) // maximum number of anomalies as percent of data
.direction(Direction::Both) // Positive, Negative, or Both
.verbose(false) // show progress
致谢
此库是从 AnomalyDetection R 包移植而来,并使用相同的许可协议。
参考文献
历史
查看 变更日志
贡献
鼓励每个人都来帮助改进这个项目。以下是一些你可以帮助的方式
开始开发
git clone https://github.com/ankane/AnomalyDetection.rs.git
cd AnomalyDetection.rs
cargo test
依赖项
~63KB