Prophet: How to exclude weekends ( saturday & Sundays) from fb Prophet

Created on 27 Jan 2020  路  1Comment  路  Source: facebook/prophet

Hello FB Prophet community,

I am getting outrageous predictions on Saturday and Sunday.Mainly because they shouldn't be there.
How can I remove weekends from the daily data to begin with.

So that my input data never has a weekend and my predictions never have a weekend.

Most helpful comment

The model won't have any issues if you remove the weekend days prior to passing in the data, and you'll just want to be sure that the dataframe of future dates that you pass into predict also has weekend days stripped out. It's pretty easy to identify weekend days in a dataframe and just drop them; here is how you would do it in pandas, and similar commands exist in R:

df_no_weekdays = df[df['ds'].dt.dayofweek < 5]

Run that command on the history before passing it into fit, and on the future dates before passing it into predict.

>All comments

The model won't have any issues if you remove the weekend days prior to passing in the data, and you'll just want to be sure that the dataframe of future dates that you pass into predict also has weekend days stripped out. It's pretty easy to identify weekend days in a dataframe and just drop them; here is how you would do it in pandas, and similar commands exist in R:

df_no_weekdays = df[df['ds'].dt.dayofweek < 5]

Run that command on the history before passing it into fit, and on the future dates before passing it into predict.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andrew-pollock picture andrew-pollock  路  3Comments

robertdknight picture robertdknight  路  3Comments

arnaudvl picture arnaudvl  路  3Comments

germayneng picture germayneng  路  3Comments

maxwell873 picture maxwell873  路  3Comments