【发布时间】:2020-03-12 21:54:45
【问题描述】:
我在 R 中使用 AnomalyDetectionTs 包在 275 天内检测异常,但有些观察不到 275 天
这是数据框
这里是每个类别的观察次数
但是当我运行异常检测代码时,我会看到以下错误消息:
Error in do.ply(i) :
task 88 failed - "With longterm=TRUE, AnomalyDetection splits the data into 2 week periods by default. You have 103 observations in a period, which is too few. Set a higher piecewise_median_period_weeks."
我在 40 周内设置了分段中位数_周期_周 如下:
AnomalyDetectionTs(df, max_anoms = 0.002, direction = "both", alpha = 0.05, e_value = FALSE, plot = FALSE, y_log = FALSE,longterm=TRUE,piecewise_median_period_weeks=40)
当我只过滤超过 103 个观察的类别时,它工作正常。 您能否帮我定义这个可以检测所有观察的参数(piecewise_median_period_weeks)。
【问题讨论】:
-
我发现的一种方法是根据每个类别的计数将动态值分配给piecewise_median_period_weeks()
-
我在使用这个包的 Python 版本时遇到了这个问题。解决这个问题的一种方法是使用替代函数 detect_vec 而不是 detect_ts
标签: r anomaly-detection