deepcharles / ruptures

ruptures: change point detection in Python
BSD 2-Clause "Simplified" License
1.6k stars 163 forks source link

ruptures got 2 out of 3 change points correct #324

Open munchine opened 4 months ago

munchine commented 4 months ago

Great tool but it seems that ruptures can correctly detect 2 out of 3 correctly. Am I doing something wrong? I’ve attached the data. Rupture_Test_Data1.xlsx

It’s a log log so here’s my code snippet `def detect_and_plot(x, y, title):

Change point detection on log-transformed data

xy = np.column_stack((x, y))
algo = rpt.Pelt(model="rbf").fit(xy)
result = algo.predict(pen=10)

x_log = np.log(data_cleaned['tD (x)'].to_numpy()) y_log = np.log(data_cleaned['pDp (y)'].to_numpy()) ` Here’s the plot and the 3rd change point, should occur around 14, but it is occurring around 19. Any guidance will be much appreciated. pDp_log_plot

deepcharles commented 4 months ago

Hi, replace algo = rpt.Pelt(model="rbf").fit(xy) by algo = rpt.Pelt(model="rbf", jump=1).fit(xy).

By default, Pelt only looks for change-points that are multiple of 5 (bad default I know).

Hope this helps