I am using fbprophet for time-series predictions in Python and I am wondering how the yhat
(prediction) column is calculated. I used the following code.
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)
The future
dataframe contains the following columns:
['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']
I understand yhat
is the prediction, but is it a combination of trend, seasonal, seasonalities, weekly, yearly
or something else?
I have tried combining the trend, seasonal, seasonalities, weekly, yearly
columns to see if they equal the yhat
column, but they do not:
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
I have been unable to find an answer in the documentation, but apologize if I have simply missed it.
I am a beginner of fbprophet
but would like to share my guess. Even though I'm not sure it is correct, The following equation probably holds true in the default setting of prophet.
yhat = trend + seasonal
Hopefully, my answer will help you!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.