如何从 Prophet 中提取季节性趋势

Mat*_*att 6 python time-series forecasting

我一直在使用 Facebook 的 Prophet,到目前为止它已经产生了一些很好的结果。

查看文档和谷歌搜索后,似乎没有一种自动方法可以从模型中提取季节性趋势作为数据框或字典,例如:

weekly_trends = { 1 : monday_trend, 2 : tuesday_trend, ... , 7 : sunday_trend } 

yearly_trends = { 1 : day_1_trend, 2 : day_2_trend, ... , 365 : day_365_trend } 
Run Code Online (Sandbox Code Playgroud)

目前我可以使用更手动的方式提取这些,但只是想知道我是否错过了更优雅的东西?

小智 7

训练好的模型数据框包含所有季节性、趋势和假期信息。- 看看它的列。以下是如何在 Python 中查看它:

m = Prophet()
m.fit(ts)
future = m.make_future_dataframe()
forecast = m.predict(future)
print(forecast['weekly'])
Run Code Online (Sandbox Code Playgroud)

从该系列中抽出任何 7 天。这将为您提供每个工作日的每周附加调整的规模。类似的年度季节性。