I'd like some assistance in using a more granular time-series in my Prophet forecast plots, specifically an Hour grain on the x-axis.
My data is aggregated for each Hour of the day. In addition to the aggregated data, I create the necessary Prophet variables with:
ads_mod['y'] = ads_mod[target1]
ads_mod['ds'] = ads_mod['hour']
I then start the modeling process:
m = Prophet(interval_width=interval_width)
m.add_seasonality(name='hourly', period=1, fourier_order=30)
m.fit(ads_mod)
future = m.make_future_dataframe(periods=1,freq='H')
forecast = m.predict(future)
I plot the Forecast with:
fig = m.plot(forecast)
I have reviewed the actual code in the plot function and tried a variety of modifications to display the hour along with date(i.e., datetime value) on the x-axis, without success. In particular, I looked at the date transform:
fcst_t = fcst['ds'].dt.to_pydatetime()
After the transform, I see my data is now in the following format, with the Hour still included. A fragment of the plot is below and you see that on the x-axis the date(i.e., YYYY,MM,DD) is the only value displayed:
fcst_t[:10]
Out[277]:
array([datetime.datetime(2019, 12, 2, 0, 0),
datetime.datetime(2019, 12, 2, 1, 0),
datetime.datetime(2019, 12, 2, 2, 0),
datetime.datetime(2019, 12, 2, 3, 0),
datetime.datetime(2019, 12, 2, 4, 0),
datetime.datetime(2019, 12, 2, 5, 0),
datetime.datetime(2019, 12, 2, 6, 0),
datetime.datetime(2019, 12, 2, 7, 0),
datetime.datetime(2019, 12, 2, 8, 0),
datetime.datetime(2019, 12, 2, 9, 0)], dtype=object)