I have been using fbprophet to make a time series prediction. I have the following dataframe:
I have tried to do a future prediction using the following code and want to predict 30 years in the future:
p_model = Prophet()
df_plot = df_grouped.copy()
df_plot = df_plot.reset_index()
total_vehicles = df_plot.groupby(['year'])['all_motor_vehicles_miles'].sum()
total_vehicles = total_vehicles.reset_index()
total_vehicles['total_miles'] = total_vehicles['all_motor_vehicles_miles'] * 365
total_vehicles[['y', 'ds']] = total_vehicles[['total_miles', 'year']]
p_model.fit(total_vehicles)
future = p_model.make_future_dataframe(periods=30, freq='Y')
forecast = p_model.predict(future)
forecast.head()
However, when plotting this, prophet has predicted in the past rather than the future from 2020 to 2050 below and I'm not sure why?
Anyone know why this is the case and how to fix it? Cheers
The issues was with my date not being in the right datetime format. Simply making sure the type was right and then putting it into prophet yielded the right answer.