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.26k stars 4.51k forks source link

Sharp decline in trend when seasonality increases #1111

Closed 99snowleopards closed 4 years ago

99snowleopards commented 5 years ago

Thanks for releasing this amazing library!

I'm using Prophet for analysis of store sales for the past two years, and for a lot of stores, I see the pattern illustrated in the figure below, where the trend declines significantly around the time that the seasonality peaks. In the figure below, you see the trend declining in July, 2018 when seasonality peaks.

I'd greatly appreciate any insight in understanding why the trend declines so sharply when the seasonality picks up:

proph

Thanks,

bletham commented 5 years ago

I'm wondering if what happened is that in the first year there was a big bump and so the model fit it as seasonality, but in the 2nd year it didn't happen again so the model adjusted the trend to keep it flat.

With only 2 years for yearly seasonality, it is possible for the model to not always do what you want in terms of what features are being modeled with seasonality vs. trend. In principle one could use trend shifts to handle all the seasonality, and the reason that doesn't usually happen is because the trend is more strongly regularized than the seasonality. This means that the model will prefer to use seasonality rather than trend changes in order to fit features of the time series.

For this time series, if it is the case that there is a bump in the first year that is being incorrectly attributed to seasonality, then I'd recommend adding a bit more regularization to the seasonality (decrease seasonality_prior_scale) to make the seasonality less flexible. That would likely improve your model fits. The default is 10, which applies essentially no regularization, and you could decrease that to 1 or 0.1 and see how it looks.

99snowleopards commented 5 years ago

thanks so much for the detailed response @bletham ! I'll try out your suggestions, and report back,