【发布时间】:2021-12-10 18:44:01
【问题描述】:
我正在使用 Facebook 的 Prophet 算法来检测时间序列中的变化点。当我查看tutorial on the website 时,我注意到prophet() 调用的输出中有多个向量指向变化点。
假设m 是你的预言机输出对象,m$changepoints 输出一个带有变化日期的向量,m$params$delta 输出变化率(我想),如论文中所述:“The generation model for the趋势是在 T 个点的历史上存在 S 个变化点,每个变化点都有一个速率
更改”(Taylor & Letham,2018. P.40)。
但是m$changepoints.t到底是什么?
起初,我认为这个向量包含在时间 t 检测到变化点的原始时间序列的值。但是当我检查 m$changepoints.t 的值时,它的值介于 0 和 1 之间,而我原来的时间序列的值没有低于 5.263。
代码如下:
# load in the log number of views to Peyton Manning’s Wikipedia page
peytondf <- read.csv("https://raw.githubusercontent.com/facebook/prophet/ba9a5a2c6e2400206017a5ddfd71f5042da9f65b/examples/example_wp_log_peyton_manning.csv")
# make a prophet object
m <- prophet(peytondf)
# Prepare a dataframe with dates over which to predict new values
future <- make_future_dataframe(m, periods = 30)
# make a forecast over the dates in the future
forecast <- predict(m, future)
我们比较一下变化点的一些不同输出,以及原始时间序列的汇总统计。
> print(m$params$delta)
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] -7.747987e-08 5.963255e-08 0.3511606 0.4575449 3.446425e-09 -3.234277e-05 -0.2446286
[,8] [,9] [,10] [,11] [,12] [,13] [,14]
[1,] -0.2479764 2.22051e-08 4.905514e-08 -4.845165e-08 0.2993031 0.2125642 0.001508987
[,15] [,16] [,17] [,18] [,19] [,20] [,21]
[1,] 0.0001771334 -0.8544597 -8.687544e-07 -8.719968e-08 7.831569e-07 0.4638492 0.01226102
[,22] [,23] [,24] [,25]
[1,] 1.597865e-07 -0.3350588 8.737527e-08 -3.928844e-08
> print(m$changepoints.t)
[1] 0.03307459 0.06513669 0.10327371 0.13533581 0.16672292 0.19811002 0.23152211 0.26425920
[9] 0.29632130 0.33007087 0.36145798 0.39284509 0.42423220 0.45561930 0.48768140 0.51974350
[17] 0.55146811 0.58285521 0.61390483 0.64529193 0.67667904 0.70840364 0.73979075 0.77151536
[25] 0.80290246
> summary(peytondf)
ds y
Length:2905 Min. : 5.263
Class :character 1st Qu.: 7.515
Mode :character Median : 7.998
Mean : 8.139
3rd Qu.: 8.580
Max. :12.847
【问题讨论】:
标签: r time-series facebook-prophet