Closed ChiQiao closed 3 years ago
Hi,
Thanks for your interest in ruptures
!
Here, you are giving as an input
With those parameters, the sanity checks verify that it can generate at least 2 segments (ie. 1 break point). Here, what you are presently asking is not feasible, indeed :
n_samples
to find the asked number of break points (n_bkps
) for some given segment minimum size (min_size
) and jump size (jump
). In your case, the following choices would work :
model = ruptures.Pelt(min_size=5, jump=1)
model.fit(np.ones(10))
model.predict(pen=0)
model = ruptures.Pelt(min_size=4, jump=1)
model.fit(np.ones(9))
model.predict(pen=0)
model = ruptures.Pelt(min_size=5, jump=2)
model.fit(np.ones(11))
model.predict(pen=0)
@ChiQiao Indeed it makes sense to return [9]
. We will see how this change propagates through the rest of the package.
Thanks
Oh, did not pay attention to the Pelt
mention and the detection methods that may return 0 break point (even more with a 0 penalty).
Will look into it !
Sanity check was added in v1.1.4 for the
Pelt
class, and raises aBadSegmentationParameters
for the example belowFor a signal with a length of 9,
min_size=5
makes sense to me and in v1.1.3 it returns[9]
. I wonder if the sanity check is too strict?