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 – True when predict returns change point indices (aeon’s “dense” format), False when it returns one state label per time point

  • capability:univariate / capability:multivariate

  • capability:unsupervised – True when the detector runs without being told the number of change points or states

  • capability:semi_supervised – True when that number can be passed to the constructor (guided mode, e.g. n_cps or n_states)

  • python_dependencies – None, or the list of optional modules the detector imports (e.g. ["torch"]); the detector fails without them

  • capability:online – True for 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#

State detection#

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, k univariate points, or a (k, n_channels) block) and returns the change points detected meanwhile as events, a structured array with the fields position (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 is detection_time - position) and score (NaN when the method has none). Events are final once emitted; any split of a series into blocks gives the same events. events_ and n_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).