tsseg.algorithms.bottomup package
Bottom-Up segmentation — agglomerative merging of segments.
Description
Contrary to binary segmentation (top-down), bottom-up segmentation starts with a fine initial partition along a regular grid and successively merges the two most similar contiguous segments until a stopping criterion is met. The procedure is generous: it begins with many change points and removes the least significant ones.
Complexity is \(O(n\log n)\) where n is the number of samples, and the algorithm supports any cost function available in the vendored ruptures library.
Parameters
Name |
Type |
Default |
Description |
|---|---|---|---|
|
int / None |
|
Number of change points. When |
|
str |
|
Ruptures cost model ( |
|
int |
|
Minimum segment length. |
|
int |
|
Grid step for candidate change points. |
|
float / None |
|
Penalty value. Mutually exclusive with |
|
float / None |
|
Reconstruction budget. Mutually exclusive with |
|
dict / None |
|
Extra parameters passed to the cost function. |
|
int |
|
Time axis. |
Usage
from tsseg.algorithms import BottomUpDetector
detector = BottomUpDetector(model="l2", n_cps=3)
labels = detector.fit_predict(X)
# Penalty-based stopping
detector = BottomUpDetector(model="l2", penalty=10)
labels = detector.fit_predict(X)
Implementation: Vendored from ruptures v1.1.8. BSD 2-Clause.
Reference: Keogh, Chu, Hart & Pazzani (2001), ICDM; Fryzlewicz (2007), JASA.