gpt4 book ai didi

python - fbprophet库中的 'yhat'(预测)是如何计算的?

转载 作者:行者123 更新时间:2023-11-30 22:22:47 25 4
gpt4 key购买 nike

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

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 数据框包含以下列:

['ds', 'trend', 'trend_lower', 'trend_upper', 'yhat_lower', 'yhat_upper', 
'seasonal', 'seasonal_lower', 'seasonal_upper', 'seasonalities',
'seasonalities_lower', 'seasonalities_upper', 'weekly', 'weekly_lower',
'weekly_upper', 'yearly', 'yearly_lower', 'yearly_upper', 'yhat']

我知道yhat是预测,但它是趋势、季节性、季节性、每周、每年还是其他内容的组合?

我尝试将 trend、seasonal、seasonality、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

我无法在文档中找到答案,但如果我只是错过了它,我深表歉意。

最佳答案

我是 fbprophet 的初学者,但想分享我的猜测。尽管我不确定它是否正确,但以下等式可能在预言家的默认设置下成立。

yhat = trend + seasonal

希望我的回答对您有帮助!

关于python - fbprophet库中的 'yhat'(预测)是如何计算的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48218323/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com