【问题标题】:Interpreting Prophet Output for Weekly and Yearly Seasonality解释每周和每年季节性的 Prophet 输出
【发布时间】:2017-12-17 03:25:18
【问题描述】:

我正在阅读在 R 中使用 prophet 的教程。

您可以在此处找到数据集: https://github.com/facebookincubator/prophet/blob/master/examples/example_wp_peyton_manning.csv

# R
library(prophet)
library(dplyr)

df <- read.csv('peyton.csv') %>%
  mutate(y = log(y))

head(df)

          ds        y
1 2007-12-10 9.590761
2 2007-12-11 8.519590
3 2007-12-12 8.183677
4 2007-12-13 8.072467
5 2007-12-14 7.893572
6 2007-12-15 7.783641

df$ds<-as.Date(df$ds,'%m/%d/%Y')

m <- prophet(df)

future <- make_future_dataframe(m, periods = 365)

forecast <- predict(m, future)

plot(m, forecast)

prophet_plot_components(m, forecast)

property_plot_components(m, forecast) 的输出如下:

我是否将此图的年度季节性部分解释为:

无论您对特定日期的预测是什么,都将其增加或减少某某量以考虑年度季节性?例如,看起来在 4 月 1 日,y 预计为 -0.5。我如何使用这个结果?我是否取一年的平均 y 并减去 -0.5 以考虑季节性?有点迷茫。

任何帮助都会很棒!

【问题讨论】:

    标签: r time-series fft continuous-fourier fourier-descriptors


    【解决方案1】:

    @尼克 Prophet predict() 函数语法如下:

    temp_dataframe_to_store_prediction <- predict(model_name, new_dataframe_created)
    

    在你的情况下:

    forecast <- predict(m, future)
    

    predict() 函数的预测或预测包括每行的趋势和季节性,即每个 time_stamp。因此,您不需要包含任何单独的代码行来在最终预测值中包含或排除季节性。 您的解释是正确的,即通过将季节性和趋势的 (+/-) 值添加到固定的“y”值来获得最终预测值。请注意,您的代码中先知使用的“y”值是 log(original_y)

     mutate(y = log(y))
    

    这条线使 original_y 值静止。因此,为了解释最终结果,您需要采用预测“y”值的指数。这使预测达到原始规模。如果 original_y 没有被转换,则无需取指数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-08
      • 1970-01-01
      相关资源
      最近更新 更多