zoukankan      html  css  js  c++  java
  • 一段充满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吧...

  • 相关阅读:
    中国剩余定理
    hdu1808-Halloween treats(抽屉原理)
    快速幂算法
    因子和与因子个数
    乘性函数
    HDU 2669 Romantic (扩展欧几里得定理)
    扩展欧几里得算法
    Bi-shoe and Phi-shoe(欧拉函数)
    欧拉函数
    [51nod]1284 2 3 5 7的倍数(容斥原理)
  • 原文地址:https://www.cnblogs.com/standby/p/9480213.html
Copyright © 2011-2022 走看看