n_changepoints greater than number of observations .
I am getting warning. what does this mean. can someone please explain what does n_changepoints mean too?
The documentation here provides a good description: https://facebook.github.io/prophet/docs/trend_changepoints.html
In essence, the default number of changepoint is 25 uniformly across the data. If your data is less than that, it will result in a warning
I have this issue in certain datasets. Is this an issue wherebe changepoint > # of rows or just a verbose warning? Thanks
Well basically if you have very few rows, it will reduce the number of changepoints to make sure that there are always less changepoints than data. It isn't necessarily an issue, but more to let you know that a specified setting (number of changepoints) was overridden. That said, the model will be more likely to overfit the changepoints when there is very little data, so if you are fitting very small time series and are seeing this warning, you may want to check that by plotting the forecasts.
@bletham hey do you know the logic of how they check if the n_changepoints are greater than number of observations.?
for example my train data size is 32 weeks , and i forecast weekly data but i get warning n_changepoints greater than number of observations. Using 24. why its 24? and how they decide how many to use instead of the default 25? thanks !
For those still wondering...
Looks like there is some logic related to this in the set_changepoints(self) function (line 429) in the Prophet forecaster class: https://github.com/facebook/prophet/blob/main/python/prophet/forecaster.py
The calculation is as follows:
hist_size = int(np.floor(self.history.shape[0] * self.changepoint_range))
if self.n_changepoints + 1 > hist_size:
self.n_changepoints = hist_size - 1
Your case: self.history.shape[0] is equal to 32, self.changepoint_range defaults to 0.8. and self.n_changepoints defaults to 25.
Therefore, hist_size = floor(32*0.8)= floor(25.6) = 25, and since 25 + 1 is greater than 25, self.n_changepoints is calculated as hist_size-1 which is 25-1=24.
Knowing this calculation may be helpful for anyone trying to implement a warm start with Prophet and facing issues with a differing number of changepoints in the trained cold start model and the new warm start model.