簡體   English   中英

fbprophet 庫中的“yhat”(預測)是如何計算的?

[英]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

希望我的回答能幫到你!

這似乎已經改變了。 查看Github代碼, yhat計算如下

yhat = (trend * (1 + multiplicative_terms) + additive_terms

fbprophet源代碼中找到了這個計算的鏈接

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM