如何在fbprophet库中计算“yhat”(预测)?

2024-05-29 04:17:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我在Python中使用fbprophet进行时间序列预测,我想知道yhat(prediction)列是如何计算的。我用了下面的代码。在

import quandl
import fbprophet

tesla = quandl.get('WIKI/TSLA')
tesla = tesla.reset_index()
tesla = tesla.rename(columns={'Date': 'ds', 'Adj. Close': 'y'})
tesla = tesla[['ds', 'y']]

prophet = fbprophet.Prophet()
prophet.fit(tesla)
future = prophet.make_future_dataframe(periods=365)
future = prophet.predict(future)

future数据帧包含以下列:

^{pr2}$

我知道yhat是预测,但它是{}的组合还是其他什么?在

我尝试过组合trend, seasonal, seasonalities, weekly, yearly列,看看它们是否等于yhat列,但它们不:

future['combination'] = future['trend'] + future['seasonal'] + future['weekly'] + future['yearly'] + future['seasonalities']

print(future[['combination', 'yhat']].head())

   combination       yhat
0    57.071956  27.681139
1    55.840545  27.337270
2    53.741200  26.704090
3    51.874192  26.148355
4    47.827763  25.065950

我在文件中找不到答案,但如果我只是错过了,请道歉。在


Tags: import时间dsfuturetrendweeklyquandlcombination
2条回答

现在情况似乎已经改变了。看看Github代码,yhat计算如下

yhat=(趋势*(1+乘法项)+加法项

我是fbprophet的初学者,但我想分享我的猜测。 即使我不确定它是否正确,下面的等式可能在prophet的默认设置下成立。在

yhat = trend + seasonal

希望我的回答能帮助你!在

相关问题 更多 >

    热门问题