Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChangePoint Detection #2648

Open
sssaha opened this issue Jan 7, 2025 · 1 comment
Open

ChangePoint Detection #2648

sssaha opened this issue Jan 7, 2025 · 1 comment

Comments

@sssaha
Copy link

sssaha commented Jan 7, 2025

I am trying to use the following code to detect changepoints - preferably range changepoints for my application.

estimator = Prophet(yearly_seasonality=True)
df = pd.read_feather(...)
df = df.rename({'Timestamp':"ds","Feeder B_MW":"y"},axis=1)
estimator.fit(df)
print(estimator.changepoints)

The estimated changepoints look like this

280 2021-01-12 16:00:00
561 2021-01-24 09:00:00
841 2021-02-05 01:00:00
1121 2021-02-16 17:00:00
1401 2021-02-28 09:00:00
1682 2021-03-12 02:00:00
1962 2021-03-23 19:00:00
2242 2021-04-04 11:00:00
2523 2021-04-16 04:00:00
2803 2021-04-27 20:00:00
3083 2021-05-09 12:00:00
3363 2021-05-21 04:00:00
3644 2021-06-01 21:00:00
3924 2021-06-13 13:00:00
4204 2021-06-25 05:00:00
4484 2021-07-06 21:00:00
4765 2021-07-18 14:00:00
5045 2021-07-30 06:00:00
5325 2021-08-10 22:00:00
5606 2021-08-22 15:00:00
5886 2021-09-03 07:00:00
6166 2021-09-14 23:00:00
6446 2021-09-26 15:00:00
6727 2021-10-08 08:00:00
7007 2021-10-20 00:00:00

which is not even close o the clear 8 changepoints in the actual data

image

Is it even possible using Prophet? Or I am missing something?

@jeremy-meyer
Copy link

By default, Prophet specifies 25 potential changepoints which are uniformly placed in the first 80% of the time series and then it does regularization to determine which of those changepoints to keep. I would double check the magnitude of these listed changepoints to see if it matches your intuition; some of them could be getting zeroed out. I would also note since it blindly does the uniform changepoint distribution, the changepoints probably won't exactly line up with the sudden jump/drop dates you have here. I don't think complete changepoint detection is possible in prophet. You can also manually specify changepoints if you want the dates to match up. See https://facebook.github.io/prophet/docs/trend_changepoints.html

Also it may be challenging fitting the trend component to these changepoints because jumps are so sudden. This is because the trend changepoint only adjusts the slope of the trend (to create a piecewise linear function). You would basically need 2 changepoints close to each jump that you see in your series. One to capture the sudden jump in slope, and another to level out the slope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants