prophet icon indicating copy to clipboard operation
prophet copied to clipboard

Number of changepoints parameter

Open denizn opened this issue 8 years ago • 6 comments

Hi,

I have noticed a "n_changepoints" parameter. Could you please clarify how this works?

What would potentially change at these "Change points". Only trend? Or any other parameters.

Thank you, Deniz

denizn avatar May 30 '18 05:05 denizn

This is discussed briefly in the first section of https://facebook.github.io/prophet/docs/trend_changepoints.html . It is the number of places at which the trend is allowed to change (the dashed lines in the first figure on that page). Further clarification on how that works I hope is in that page there, but let me know if there is something there that isn't clear.

It affects only the trend, not the seasonality or other linear components.

bletham avatar May 30 '18 23:05 bletham

Can you please clarify below statement? What is meant by adjusting the regularization? How would we execute that?

"The number of potential changepoints can be set using the argument n_changepoints, but this is better tuned by adjusting the regularization."

denizn avatar May 31 '18 00:05 denizn

Instead of allowing the trend to change at 25 points (the default), you could for instance cut that down to 5 - the trend now is more restricted in its ability to change.

One might consider doing this to make sure the trend doesn't overfit, but a better way to restrict the trend and make sure it doesn't overfit is to reduce the changepoint_prior_scale parameter. This parameter is described later on in that same page of documentation, and there are some examples showing how it dampens trend changes.

bletham avatar Jun 01 '18 00:06 bletham

I am, unfortunately working on 2 years of weekly data, so I only have two seasons in total and 104 data points maximum.

For such a case should I limit the n_changepoints to 1 or 2 in order to set a fixed yearly trend?

Deniz

denizn avatar Jun 01 '18 01:06 denizn

You can set n_changepoints=0 to get a linear trend without any changepoints.

bletham avatar Jun 01 '18 21:06 bletham

This seems to be resolved but please reopen if there are additional questions along this line.

bletham avatar Jun 07 '18 19:06 bletham