在Github上搜索“Anomaly Detection”,Twitter的异常检测框架(基于R语言)高居榜首,可见效果应该不错:git
可是活跃度并不高,3-4年没人维护了:github
所以在使用时不免会遇到一些坑,整个使用方式以下(红色部分,就是直接在RStudio中运行时,可能有异常的地方):框架
install.packages("devtools")
devtools::install_github("twitter/AnomalyDetection")
library(AnomalyDetection)
data(raw_data)
res = AnomalyDetectionTs(raw_data, max_anoms=0.02, direction='both', plot=TRUE)
res$plot
1.devtools::install_github("twitter/AnomalyDetection")spa
异常以下:3d
Error in process_initialize(self, private, command, args, stdin, stdout, :
processx error, setup stdio: #2 The system cannot find the file specified.
at 'win/processx.c:984'
In addition: Warning messages:
1: In untar2(tarfile, files, list, exdir) :
skipping pax global extended headers
2: In untar2(tarfile, files, list, exdir) :
skipping pax global extended headers
该问题没有很好解决,同事用RStudio下载是能够的,而后把下载到R下library里的AnomalyDetection拷贝到我机器上对应目录下code
2.res = AnomalyDetectionTs(raw_data, max_anoms=0.02, direction='both', plot=TRUE)blog
异常以下:ip
Error: Column x is a date/time and must be stored as POSIXct, not POSIXlt
该问题已经有人解决了,而且提交了PR:https://github.com/twitter/AnomalyDetection/pull/92ci
因此从新下载了修复后的异常检测代码:it
devtools::install_github("caijun/AnomalyDetection")
关于Twitter异常检测的一些连接:
1.Github上的源代码
https://github.com/twitter/AnomalyDetection
2.Twitter异常检测的能力范围:
https://anomaly.io/anomaly-detection-twitter-r/
3.在简书上概括Twitter异常检测的帖子:
https://www.jianshu.com/p/02ba9ce11656