![](/img/trans.png)
[英]How can i get 'y' rather than 'yhat' from predicted data by using fbprophet?
[英]How is 'yhat' (prediction) calculated in the fbprophet library?
我在 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, seasonalities, weekly, yearly
還是其他的組合?
我嘗試將trend, seasonal, seasonalities, weekly, yearly
列結合起來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
我一直無法在文檔中找到答案,但如果我只是錯過了,請道歉。
我是fbprophet
的初學者,但想分享我的猜測。 即使我不確定它是否正確,以下等式可能適用於 prophet 的默認設置。
yhat = trend + seasonal
希望我的回答能幫到你!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.