在Github上搜索“Anomaly Detection”,Twitter的異常檢測框架(基於R語言)高居榜首,可見效果應該不錯:

但是活躍度並不高,3-4年沒人維護了:

因此在使用時難免會遇到一些坑,整個使用方式如下(紅色部分,就是直接在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")
異常如下:
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拷貝到我機器上對應目錄下
2.res = AnomalyDetectionTs(raw_data, max_anoms=0.02, direction='both', plot=TRUE)
異常如下:
Error: Column x is a date/time and must be stored as POSIXct, not POSIXlt
該問題已經有人解決了,並且提交了PR:https://github.com/twitter/AnomalyDetection/pull/92
所以重新下載了修復后的異常檢測代碼:
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
