facebook / prophet

Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.
https://facebook.github.io/prophet
MIT License
18.44k stars 4.53k forks source link

Monthly seasonality does not seem to be working correctly #1927

Open Ali-Aziz opened 3 years ago

Ali-Aziz commented 3 years ago

I am modeling daily revenue and the data exhibits monthly seasonality. The revenue is typically lower at the start of the month and higher in the second part of the month, especially in the last few days. When I added this (custom) seasonality to the model fbprophet seemed to learn this behavior to some extent as shown here.

image

To illustrate the problem a sample of two months is copied below. Adding monthly seasonality improved model performance towards the end of the month (green circles). However, for some reason, the forecasts actually became higher/worse in the first few days of the month (red circles).

image image

Does anyone have any ideas on how to fix this? Could this have to do with the fact that the period for monthly seasonality is set to 30.5 (as in the documentation) and so over time it can become out of sync?

Looking forward to your suggestions. Thank you!

Additional information: • Currently the monthly seasonality has been added in the code as follows: m.add_seasonality(name='monthly', period=30.5, fourier_order=5) • I removed yearly seasonality but I still observed the same issue • The only other seasonality is weekly: image

Ali-Aziz commented 3 years ago

I was reading the following issue and I think the underlying reason might be the same i.e. the sudden change from the end of the one month to the beginning of the next. https://github.com/facebook/prophet/issues/338

thisisreallife commented 3 years ago

I came across the same problem in monthly seasonality, see #1923 . I generate a linear monthly seasonality and then fit data with add_seasonality(name='monthly', period=30.5, fourier_order=5), but the result is strange.

Ali-Aziz commented 3 years ago

I see, thanks for the comment!

I tried increasing the Fourier order from 5 to 10 and then 20 but it did not help much.

I am not sure yet how to go about replacing monthly seasonality with holiday/window effects. For the data I am dealing with I don't think it is straightforward to define the timing and duration of these holidays.

thisisreallife commented 3 years ago

YES, agreed with you. Set holiday/window effect may not be realistic. Suppose I have 1000 different ts to decompose, each has different patterns. I cannot set holiday effects for each ts one by one....