diff options
Diffstat (limited to 'lib/pelt.py')
-rw-r--r-- | lib/pelt.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/pelt.py b/lib/pelt.py index bd79c9b..95e828a 100644 --- a/lib/pelt.py +++ b/lib/pelt.py @@ -102,12 +102,16 @@ class PELT: changepoints = algo.predict(pen=penalty) if len(changepoints) and changepoints[-1] == len(signal): changepoints.pop() + if len(changepoints) and changepoints[0] == 0: + changepoints.pop(0) return penalty, changepoints if self.algo == "dynp" and num_changepoints is not None: - changepoints = algo.predict(pen=penalty) + changepoints = algo.predict(n_bkps=num_changepoints) if len(changepoints) and changepoints[-1] == len(signal): changepoints.pop() + if len(changepoints) and changepoints[0] == 0: + changepoints.pop(0) return None, changepoints queue = list() |