tsseg.algorithms.pelt package
PELT — Pruned Exact Linear Time change point detection.
Description
PELT solves the penalised change point optimisation problem exactly by
pruning the search space with a dynamic-programming rule. Under mild conditions
on the change point distribution, the average complexity is
\(O(C\,K\,n)\) — linear in the number of samples — where K is the number
of change points and C the cost function complexity. In practice, "l2"
cost models are significantly faster than linear or autoregressive ones.
Key tuning levers:
penalty— higher values produce fewer change points.min_size— minimum distance between change points.jump— grid step for admissible positions.
Parameters
Name |
Type |
Default |
Description |
|---|---|---|---|
|
str |
|
Ruptures cost model. |
|
int |
|
Minimum segment length. |
|
int |
|
Grid step for candidate positions. |
|
float |
|
Penalty threshold for the PELT stopping criterion. |
|
dict / None |
|
Extra keyword arguments for the cost factory. |
|
int |
|
Time axis. |
Usage
from tsseg.algorithms import PeltDetector
detector = PeltDetector(model="l2", penalty=10)
labels = detector.fit_predict(X)
Implementation: Vendored from ruptures v1.1.8. BSD 2-Clause.
Reference: Killick, Fearnhead & Eckley (2012), Optimal detection of changepoints with a linear computational cost, JASA.