【问题标题】:FB-Prophet getting change points in R: what does m$changepoints.t represent?FB-Prophet 在 R 中获得变化点:m$changepoints.t 代表什么?
【发布时间】: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


    【解决方案1】:

    默认情况下,Prophet 使用 25 个潜在变化点,这些变化点均匀分布在您的时间序列中,但其中一些未被使用。 print(m$changepoints.t) 显示所有潜在的变化点。您可以可视化最终与

    一起使用的变更点
    plot(m, forecast) + add_changepoints_to_plot(m)
    

    Trend Changespoints Prophet

    【讨论】:

    • 感谢您的回答,对于潜在变化点的值代表什么,我还是有些疑惑。或者它们根本不代表任何有用的东西?例如,是否可以将其理解为某种数字,假设潜在变化点转化为真实变化点的可能性有多大?
    • 如果您查看 paras$delta 的非零值,这就是模型中存在拐点的地方。据我了解,这就是变化点发生的地方。对于 paras$delta 接近于零的位置,胎面只是继续而没有变化。请注意,默认情况下,Prophet 仅将更改点放在时间序列的前 80% 中,因此 m$changepoints.t 的值是跨时间序列的分数距离。要查看 25 个实际时间,请使用 m$changepoints。总之,Prophet 使用的实际变化点是 m$changepoints,其中 m$paras$delta 不为零。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-07-07
    • 2017-12-28
    • 2019-02-25
    • 1970-01-01
    • 2015-01-30
    • 2020-05-07
    • 1970-01-01
    相关资源
    最近更新 更多