diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2021-01-15 11:03:00 +0100 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2021-01-15 11:03:00 +0100 |
commit | 34cd6f989de6a7f1eec27d8390b179c0f943e2a4 (patch) | |
tree | d377a1e506b17eaf10ff9723b725cf90fbdcab87 /lib/pelt.py | |
parent | 26c1dc5e9eaf46498a5ea77c41d1fe7b4f26b59c (diff) |
pelt: Fix Dynp support
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() |