一段充满bug的R程序,慎入 ...
twitter的AnomalyDetection 官网效果图如下:
尝试写了下面这个R程序:
get_specify_df <- function(start_ts,stop_ts,category='totaluploadspeed'){ library(httr) library(rlist) library(jsonlite) base <- "http://8.8.8.8/path" url <- paste(base,start_ts,'&end_time=',stop_ts,sep="") response <-GET(url) result <- fromJSON(content(response, as="text",encoding='utf-8')) if(1 == result$status) { # Fix here in the future... # specify_df <- list.stack(list.select(result$result,result$result$datetime,result$result$category)) specify_df <- list.stack(list.select(result$result,result$result$datetime,result$result$'totaluploadspeed')) return(specify_df) } return(NULL) } specify_df <- get_specify_df('153386640','1533870000','totaluploadspeed') library(AnomalyDetection) data(specify_df) res = AnomalyDetectionTs(specify_df, max_anoms=0.02, direction='both', plot=TRUE) res$plot
想利用Twitter开源的这个异常检测模块,但是遇到的问题很多,R语言本身可参考资料不多,并且目前貌似已经没人维护了...
所以暂时不想把过多的时间放在这上面,还是改用Python吧...
作者:Standby — 一生热爱名山大川、草原沙漠,还有我们小郭宝贝!
出处:http://www.cnblogs.com/standby/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
出处:http://www.cnblogs.com/standby/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。