deepcharles/ruptures

How to get the best number of the break point?

dzheng2333 opened this issue · 1 comments

model = "l2" # "l1", "rbf", "linear", "normal", "ar",...
algo = rpt.Binseg(model=model).fit(data)
my_bkps = algo.predict(5)

show results

rpt.show.display(data, my_bkps, figsize=(10, 6))
plt.xticks(range(39),x_ticks,rotation=60)
plt.show()

Here is my current code that I have to set the n_brk with specific values. However, for my dataset, I don't know the break point data, so how can I get the best number of the break point?

Many thanks

Hi,

Thanks for your interest in ruptures.

When the number of changes is not known, you must use a penalized approach. To understand what it is, you can refer to this article of mine.

In terms of code, this amounts to

my_bkps = algo.predict(pen=penalty_value)

where penalty_value is a positive float that controls how many changes you want (higher values yield less changes). Finding a correct value is really dependant on your situation. I will need more information about your signal to further help you.