使用Twitter异常检测框架遇到的坑

  在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

原文地址:https://www.cnblogs.com/liugh/p/9932550.html