facebook/prophet

Model fit behaves very differently between `datetime64[ns]` and `datetime64[ms]`.

secondtom opened this issue · 2 comments

I was unknowingly passing a dtype of datetime64[ms] to prophet and getting a very poor fit. Converted back to datetime64[ns] and model fit behaved as expected. It might be worth adding a check to warn other users.

My approach to convert was: df['ds'] = pd.to_datetime(df['ds'].dt.strftime('%Y-%m-%d'))

I don't know how many hours I wasted chasing down this tricky behavior. The worst part was there were no warnings and model fits fine also, the predictions are however very poor.
My fix was:

pd.set_option("mode.copy_on_write", True)
df_group["ts"] = df_group["ts"].astype('datetime64[ns]')