tsseg: time series segmentation in Python#

ECML-PKDD 2026Read the demo paper

Time series segmentation in Python

Change point detection and state detection: 30+ algorithms behind one scikit-learn-style API, with the metrics to evaluate them.

$pip install tsseg
detector.fit_predict(X)
A segmented time series A two-channel series with three change points (triangles) that split it into four segments, labelled with recurring states A, B, C and A again. ABCA change points: where it changes states: which regime, recurring
30+detectors, classic to deep
2tasks: change points and states
12evaluation metrics
592series benchmarked in TSB-SEG
What is tsseg?

Two questions about one series

tsseg gathers classic and recent algorithms for time series segmentation behind a single API. It covers the two faces of the problem.

Change point detection

Where does the behaviour change?

Output
the sorted indices where a new segment starts
Example
[580, 1125, 2050, 2465, 3995]
State detection

Which recurring state is each point in?

Output
one integer label per time point
Example
[0, 0, …, 2, 2, …, 1, 1, …, 0, 0, …]
Overview of tsseg: a multivariate series loaded from a labelled dataset (human activity, physiology, motion and surgery, industry and energy, animal behaviour, Earth observation) is segmented by a method from any family, behind one API, into change points and recurring states (A, B, then A again); metrics such as F1, Covering, ARI and the State Matching Score evaluate it against the truth
Highlights

Ready for your own series

One API for every method

Each detector is a scikit-learn estimator that follows the segmenter interface of aeon: fit, predict, fit_predict, get_params, clone.

Unsupervised or guided

Run a detector without knowing how many segments to expect, or pass the number of change points or states to its constructor when you know it. Tags tell which modes each detector supports.

Benchmarked

TSB-SEG (NeurIPS 2026) evaluates 26 tsseg detectors on 592 series from 8 datasets, for both tasks, and publishes every run: pick a method from measured results.

Quick start

Segment a recording in a few lines

Segment a motion-capture recording bundled with tsseg, then score both results against its ground truth.

  1. Install tsseg; the state detector of this example needs pip install "tsseg[accelerators,aeon]".
  2. Load a series: a NumPy array of shape (n_timepoints, n_channels), a pandas Series or DataFrame.
  3. Fit and predict with any detector, then score the result.
quickstart.py
from tsseg import load_mocap
from tsseg.algorithms import BottomUpDetector, ClapDetector
from tsseg.algorithms.utils import extract_cps
from tsseg.metrics import Covering, StateMatchingScore

# 4 channels (arms and legs), one activity label per time point
X, y = load_mocap(trial=0)  # X: (4579, 4), y: (4579,)
true_cps = extract_cps(y)  # [ 588 1200 2006 2530 3282 4048]

# Change point detection: where does the movement change?
cps = BottomUpDetector(model="rbf", pen_scale="bic").fit_predict(X)
print(cps)  # [ 580 1125 2050 2465 3995]
print(Covering().compute(true_cps, cps, n_timepoints=len(X))["score"])  # 0.748

# State detection: which activity is each time point in?
states = ClapDetector().fit_predict(X)
print(StateMatchingScore().compute(y, states)["score"])  # 0.700

# Know how many segments to expect? Pass it to the constructor (guided mode)
from tsseg.algorithms import DynpDetector

print(DynpDetector(model="rbf", n_cps=6).fit_predict(X))
# [ 595 1145 2160 2455 3300 4115]
Examples

Eight worked examples on public data

From the narrative voice of a Victorian novel to a night of sleep recordings: each example asks a question about a real record, answers it with one detector and checks the result against a reference the detector never sees.

Find the right method

An interactive map of the methods

Every detector placed by how it searches for a segmentation and by what makes a segment homogeneous. Filter by task, mode or install, search by name or idea, and open any method in one click.

search procedure →↓ homogeneity criterion
Interactive demo

Try it in the browser

The tsseg demo on Hugging Face Spaces loads a series, runs segmentation algorithms, then compares and evaluates their results, with nothing to install.

The sample dataset of the tsseg demo, a four-channel motion-capture recording: the ground truth (seven segments in four states, state A coming back three times), the change points found by BottomUp with an RBF cost without being told how many (Covering 0.75), and the states found by Time2State told that there are four (State Matching Score 0.93)
Cite tsseg

Published at ECML-PKDD 2026

Demo Track · Lecture Notes in Computer Science

tsseg: An Interactive Toolkit for Time Series Segmentation

Félix Chavelli, Arik Ermshaus, Fan Yang, Patrick Schäfer, John Paparrizos, Paul Boniol

doi:10.1007/978-3-032-37685-5_41

Please also cite:

BibTeX entries for all three are in the README and in CITATION.cff.

tsseg.bib
@inproceedings{tsseg2026,
  title     = {tsseg: An Interactive Toolkit for Time Series Segmentation},
  author    = {Chavelli, F{\'e}lix and Ermshaus, Arik and Yang, Fan and
               Sch{\"a}fer, Patrick and Paparrizos, John and Boniol, Paul},
  booktitle = {Machine Learning and Knowledge Discovery in Databases.
               Applied Data Science Track, Demo Track and Industrial Track},
  series    = {Lecture Notes in Computer Science},
  year      = {2026},
  pages     = {391--394},
  publisher = {Springer Nature Switzerland},
  doi       = {10.1007/978-3-032-37685-5_41}
}
People

Contributors

FC
Félix ChavelliInria, ENS, Paris
AE
Arik ErmshausHumboldt-Universität, Berlin
FY
Fan YangThe Ohio State University, Columbus
PB
Paul BoniolInria, ENS, Paris
PS
Patrick SchäferHumboldt-Universität, Berlin
JP
John PaparrizosThe Ohio State University, Columbus; Aristotle University of Thessaloniki

Contributions are welcome: see the contributing guide. tsseg is released under the AGPL-3.0; several detectors bundle adapted or vendored code under their own licenses, listed in the README.