Detectors#
tsseg.algorithms exposes 30+ segmentation algorithms behind a common
fit / predict / fit_predict API. Every detector inherits from
tsseg.algorithms.base.BaseSegmenter, which follows the segmenter API of
aeon (a copy of it: tsseg does
not depend on aeon for the base class).
Each detector declares its capabilities through tags, read with
detector.get_tag(name):
detector_type–"change_point_detection"or"state_detection"returns_dense–Truewhenpredictreturns change point indices (aeon’s “dense” format),Falsewhen it returns one state label per time pointcapability:univariate/capability:multivariatecapability:unsupervised–Truewhen the detector runs without being told the number of change points or statescapability:semi_supervised–Truewhen that number can be passed to the constructor (guided mode, e.g.n_cpsorn_states)python_dependencies–None, or the list of optional modules the detector imports (e.g.["torch"]); the detector fails without themcapability:online–Truefor the online detectors (see Online detectors)
The interactive taxonomy places the detectors by how they
search for a segmentation and by what makes a segment homogeneous. Below, they
are grouped by task: change point detection returns a sorted array of
change point indices (each index is the first point of a new segment; by
convention 0 and the series length are left out), state detection
returns an array of integer state labels of the same length as the series.
Change point detection#
Change point detection
- AMOC
- BEAST
- BinSeg
- BOCD
- BottomUp
- ChangeFinder
- ChangeFinder online
- changeforest
- ClaSP
- ClaSS
- DynP
- E-Agglo
- ESPRESSO
- FLOSS
- FLUSS
- GreedyGaussian (GGS)
- iCID
- InformationGain (IGTS)
- KCPD
- l1 trend filtering
- PELT
- Prophet
- Ruptures (vendored)
- Seeded Binary Segmentation
- RuLSIF
- SST
- tGLAD
- TIRE
- TS-CP2
- Cachalot
- Window
State detection#
State detection
Baseline#
Baseline
Online detectors#
An online detector (tag capability:online, base class
tsseg.algorithms.base_online.BaseOnlineSegmenter; for now
ClaSS, ChangeFinder online and
FLOSS) also ingests a stream:
update(X)takes new points (a scalar,kunivariate points, or a(k, n_channels)block) and returns the change points detected meanwhile as events, a structured array with the fieldsposition(first point of the new segment, counted from the start of the stream),detection_time(last point ingested when the event was emitted; the delay isdetection_time - position) andscore(NaNwhen the method has none). Events are final once emitted; any split of a series into blocks gives the same events.events_andn_seen_hold every event and the number of points seen.predict(X)replays a stream on a copy of the detector and returns the positions, so the offline metrics and batch pipelines apply unchanged; it leaves the stream of the detector untouched.reset_stream()restarts the stream and keeps the fitted state;fit(warm-up or calibration, empty for ClaSS) also restarts it.
Online detectors take no number of change points (capability:semi_supervised
is False), and the tag online:memory ("constant", "window" or
"growing") states how their state grows with the stream.
Conventions#
Note
The fit signature is fit(X, y=None). For unsupervised algorithms
y must be None; passing it is reserved for semi-supervised or
supervised detectors that explicitly support it.
Parameters that used to be inferred from y (such as n_segments or
n_states) must now be passed explicitly to the constructor. Their name
depends on the detector (n_cps, n_change_points, n_segments,
n_states, …): see each detector’s page.
See Contributions for the full detector-side contract (tags,
output shapes and the estimator-check test suite that every algorithm in
__all__ must pass).