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.38k stars 4.52k forks source link

Handling nonstationarity in the changepoint distribution / controlling future trend variance #293

Open zippeurfou opened 7 years ago

zippeurfou commented 7 years ago

Hi, I really love the package, thank you very much for such an awesome work! According to https://github.com/facebookincubator/prophet/blob/master/R/R/prophet.R#L877 the forecast change point follow a random uniform function which goes accordingly the paper:

The assumption that the trend will continue to change with the same frequency and magnitude as it has in the history is fairly strong, so we do not expect the uncertainty intervals to have exact coverage.

One could imagine a prediction on data where the change point follow a non uniform distribution (i.e. new product appears following an exponential distribution). Even if the historical change point were manually entered the forecast would not follow the same distribution. Is that a fair assumption? If yes, is there a way to account for that? Another question that I have is concerning the rate adjustments in the forecast. As far as I understand (from https://github.com/facebookincubator/prophet/blob/master/R/R/prophet.R#L887) the rate of change is assumed to have a shared lambda following a maximum likelihood from historical data. However, aren't we possibly missing a trend in it? One could imagine a model where the rate of adjustment keep getting smaller and smaller through time and even if lambda might be low, you might be missing the "trend". Again, is this a fair assumption? and if yes, is there a way to account for that?

bletham commented 7 years ago

This is a great question. Basically, for estimating trend uncertainty we assume that the change-generating distribution is constant throughout past and history. So its parameter lambda that we fit in the past (the average size of the past changes) can be projected forward.

As you describe, this would be incorrect if the changepoint distribution is non-stationary, for instance if the size of the changes has a decreasing trend. Or, if there was a period in the past with large changes that we know will not occur again in the forecast horizon.

Right now there is no way to incorporate this prior knowledge into the changepoint distribution. I think it will be challenging to do this in a clean / clear interface, but we'll have to put some more thought into this, or hear if anyone has any thoughts / suggestions.