怎样评价时间序列异常检测的效果( 三 )


怎样评价时间序列异常检测的效果


如果你想想象正在发生的事情,现在尝试另一个绘图功能是一个好点plot_anomaly_decomposition()。它只适用于单个时间序列,因此我们只需选择一个即可查看。“季节”正在消除每周的循环季节性。趋势是平滑的,这对于消除集中趋势而不过度拟合是合乎需要的。最后,分析剩余部分以检测最重要的异常值的异常。
tidyverse_cran_downloads %\u0026gt;% # Anomalize time_decompose(count, method = "stl", frequency = "auto", trend = "auto") %\u0026gt;% anomalize(remainder, method = "iqr", alpha = 0.05, max_anoms = 0.2) %\u0026gt;% # Plot Anomaly Decomposition plot_anomaly_decomposition() + ggtitle("Lubridate Downloads: Anomaly Decomposition")
怎样评价时间序列异常检测的效果



怎样评价时间序列异常检测的效果

怎样评价时间序列异常检测的效果

?
异常下限和上限最后一步是围绕“观察”值创建下限和上限。这是工作time_recompose(),它重新组合观察值周围的异常的下限和上限。创建了两个新列:“recomposed_l1”(下限)和“recomposed_l2”(上限)。
## # A time tibble: 6,375 x 11 ## # Index: date ## # Groups: package ## package date observed season trend remainder remainder_l1 ## ## 1 tidyr 2017-01-01 873. -2761. 5053. -1418. -3748. ## 2 tidyr 2017-01-02 1840. 901. 5047. -4108. -3748. ## 3 tidyr 2017-01-03 2495. 1460. 5041. -4006. -3748. ## 4 tidyr 2017-01-04 2906. 1430. 5035. -3559. -3748. ## 5 tidyr 2017-01-05 2847. 1239. 5029. -3421. -3748. ## 6 tidyr 2017-01-06 2756. 367. 5024. -2635. -3748. ## 7 tidyr 2017-01-07 1439. -2635. 5018. -944. -3748. ## 8 tidyr 2017-01-08 1556. -2761. 5012. -695. -3748. ## 9 tidyr 2017-01-09 3678. 901. 5006. -2229. -3748. ## 10 tidyr 2017-01-10 7086. 1460. 5000. 626. -3748. ## # ... with 6,365 more rows, and 4 more variables: remainder_l2 , ## # anomaly , recomposed_l1 , recomposed_l2
怎样评价时间序列异常检测的效果


让我们看一下“lubridate”数据。我们可以使用plot_anomalies()和设置time_recomposed = TRUE。此功能适用于单个和分组数据。
time_decompose(count, method = "stl", frequency = "auto", trend = "auto") %\u0026gt;% anomalize(remainder, method = "iqr", alpha = 0.05, max_anoms = 0.2) %\u0026gt;% time_recompose() %\u0026gt;% # Plot Anomaly Decomposition plot_anomalies(time_recomposed = TRUE) + ggtitle("Lubridate Downloads: Anomalies Detected")
【怎样评价时间序列异常检测的效果】 怎样评价时间序列异常检测的效果



怎样评价时间序列异常检测的效果


推荐阅读