【发布时间】:2021-11-28 09:59:09
【问题描述】:
我之前没有做过任何时间序列预测,我尝试根据每小时的日期时间段预测来自呼叫中心的总呼叫数据量。当我绘制预测时,数据被正确绘制,但预测偏离了。
这是我使用的代码。和入门的差不多。
df.rename(columns={'date':'ds','count':'y'},inplace=True)
df["ds"] = pd.to_datetime(df["ds"])
new_data=df[['ds','y']]
#input data to prophet model and forecast
model = Prophet()
model.fit(new_data)
future = model.make_future_dataframe(periods=15)
forecast = model.predict(future)
fig = model.plot(forecast, xlabel='ds', ylabel='y')
plt.title('forecasting')
plt.show()
而且数据正在被使用,
ds y
2021-10-01 13:00:00 2871
2021-10-01 14:00:00 2545
2021-10-01 15:00:00 2426
2021-10-01 16:00:00 2446
2021-10-01 17:00:00 299
想知道我是否没有正确设计先知模型,代码或数据格式错误。
【问题讨论】:
-
您查看过用于每日预测的 API 吗?您的数据是否完整且没有 NaN 等?对于每小时预测,您的数据是从 00:00:00 到 23:00:00。
-
没有任何 NaN 值,它在时区 00.00 到 23.00。
标签: python pandas time-series forecasting facebook-prophet