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

A way to extend initial uniform distribution of change points to the last 20% of data? #515

Closed matse004 closed 6 years ago

matse004 commented 6 years ago

I'm using Prophet to detect significant change points in daily sales data.

I'd like to know by the end of each week or 2 weeks if there was a new candidate for a change point, that appeared in that recent time frame. But Prophet only puts candidate change points in the first 80%, so I have to limit data to 5-10 weeks long, which kills seasonality information.

What is the rational for using only first 80% of data? Is it reasonable to try increase the number for the case described? What would be a way to do so?

Thanks in advance! Loving Prophet, thanks much guys!

bletham commented 6 years ago

This is a really interesting use case that I was talking to someone about just a couple weeks ago.

The reason for the 80% is because the trend that is extrapolated forward for the forecast will be that of the last segment. So we wanted to make sure we had plenty of runway for estimating the trend in that last segment, saving 20% of the data for that helps to protect against overfitting a small bump at the end of the time series.

There are a couple open PRs for exposing this as a parameter (#299, #439) and this will definitely be part of the next version.

In the meantime, you can always specify the locations of the potential changepoints manually, instead of letting Prophet put them through the first 80% by default. There is a changepoints argument that allows you to pass in a list of dates to use for changepoints. These dates do not have to be in the first 80% and can be wherever you want them to be. See the last section on this page for an example: https://facebook.github.io/prophet/docs/trend_changepoints.html.

bletham commented 6 years ago

This should be described better in the documentation.

matse004 commented 6 years ago

@bletham, thanks much for the response!

I think changepoints argument is well documented - it was easy for me to find it and learn more about it. But my use case is different - I actually need auto discovery of change point candidates.

Will be looking into PRs and waiting for the new version! Thanks so much for the project again!

matse004 commented 6 years ago

Was also wondering if you guys have any plans on adding an option to mix specified checkpoints with automated ones? So that a user can provide a list of checkpoints, and the model will use both the list and the standard procedure.

Thanks!

bletham commented 6 years ago

That's not really on my radar. The automated ones are just a grid of 25 points, it's not very sophisticated and I think that if one is generating a manual list anyway it would be one extra line to append a grid of other points. My preference is to continue letting manual be entirely manual, but to document this a bit better.

bletham commented 6 years ago

v0.3 now has changepoint_range to do this, as described in https://facebook.github.io/prophet/docs/trend_changepoints.html