prophet
prophet copied to clipboard
forecaster.preprocess() may introduce unwanted behavior for NaN history values in 1.1.5
I have noticed that the changes made to this line may introduce unwanted behavior in the future dataframe:
https://github.com/facebook/prophet/blob/c00f6a2d72229faa6acee8292bc01e14f16f599c/python/prophet/forecaster.py#L1133
This will make make_future_dataframe() ignore the dates with NaN values in the history, considering
history = df[df['y'].notnull()].copy()
in the versions prior to 1.1.5 (for reference):
self.history_dates = pd.to_datetime(pd.Series(df['ds'].unique(), name='ds')).sort_values()
Notice that the dataframe df['ds'].unique()is used instead of the not null history['ds'].unique()
Thanks for noticing this! It makes sense that we'd want predictions for missing y dates in the history. More than happy to review a PR if you have time to raise a bug fix, otherwise I'll try get to it in the next couple of weeks.
Hey @tcuongd,
I've created the PR to fix the bug and added a test for make_future_dataset(,,include_history=True)