Skip to main content

tsseg logo

Time series segmentation in Python
Change point detection and state detection: 30+ algorithms, one scikit-learn-style API

Paper: ECML-PKDD 2026 PyPI version PyPI downloads Python 3.10 | 3.11 | 3.12 CI status Documentation Interactive demo on Hugging Face Spaces License: AGPL-3.0 Ruff

Documentation · Live demo · Detectors · Metrics · Changelog · Benchmark

Published at ECML-PKDD 2026 (Demo Track, Naples): tsseg: An Interactive Toolkit for Time Series Segmentation, Lecture Notes in Computer Science, Springer, doi:10.1007/978-3-032-37685-5_41

What is tsseg?

tsseg gathers classic and recent algorithms for time series segmentation behind a single API, with the metrics to evaluate them and an interactive demo to compare them. It covers the two faces of the problem:

Change point detection State detection
Question Where does the behaviour of the series change? Which recurring state is each time point in?
Output the sorted indices where a new segment starts one integer label per time point
Example [580, 1125, 2050, 2465, 3995] [0, 0, …, 2, 2, …, 1, 1, …, 0, 0, …]

A MoCap recording segmented in the tsseg demo: ground truth, change point detection and state detection
A motion-capture recording bundled with tsseg, as shown in the interactive demo: ground truth (top), the change points of a change point detector (middle) and the states of a state detector (bottom).

Highlights

  • 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.
  • Metrics for both tasks. F1, covering, Hausdorff distance and Gaussian F1 for change points; ARI, AMI, NMI, their time sensitive counterparts, and the interpretable SMS for states.
  • Light core, opt-in extras. The core needs NumPy, pandas, SciPy, scikit-learn and statsmodels. PyTorch, TensorFlow, Prophet or numba are installed only for the detectors that use them.
  • Fast classics. PELT, BinSeg, BottomUp, DynP and Window run on a vendored copy of ruptures with an optional numba backend.
  • Benchmarked. TSB-SEG (NeurIPS 2026) evaluates 26 tsseg detectors on 592 series from 8 datasets, for both tasks, and publishes every run.
  • Try it in the browser. The interactive demo loads a custom series, runs the detectors and compares their results, with nothing to install.

Installation

pip install tsseg

Most detectors work with this alone. Those built on heavier libraries need an extra, for instance pip install "tsseg[torch]", or all of them at once with pip install "tsseg[all]":

Extra Adds For
tsseg[accelerators] Numba, Cython AutoPlait, CLaP, ClaSP and E-Agglo (required); HDP-HSMM (speed-up)
tsseg[aeon] aeon's time series classifiers ClapDetector
tsseg[torch] PyTorch TireDetector, Time2StateDetector, E2USDDetector
tsseg[tglad] PyTorch, NetworkX TGLADDetector
tsseg[tscp2] TensorFlow, TCN layer TSCP2Detector
tsseg[snlds] TensorFlow, TensorFlow Probability SNLDSDetector
tsseg[prophet] Prophet ProphetDetector
tsseg[beast] Rbeast BeastDetector
tsseg[changeforest] changeforest ChangeForestDetector
tsseg[fluss] stumpy FLUSSDetector
tsseg[docs] Sphinx toolchain building the documentation
tsseg[all] everything above

The tsseg[patss] extra installs nothing: the deprecated PatssDetector needs npbad, which is not on PyPI and must be installed by hand.

tsseg[tscp2], hence tsseg[all], needs Python 3.10 to 3.12: the TensorFlow versions it pins (below 2.19) have no wheel for Python 3.13 or later. On Linux, torch from PyPI comes with the CUDA libraries; without a GPU, install its CPU build first, as the CI does: pip install torch --index-url https://download.pytorch.org/whl/cpu.

From source

In a virtual environment:

git clone https://github.com/fchavelli/tsseg.git
cd tsseg
python -m venv .venv
source .venv/bin/activate      # Windows: .venv\Scripts\activate
pip install -e ".[all,dev]"

make install does the same in .venv (make help lists its options, such as EXTRAS=dev,torch, VENV_PYTHON=python3.12 or TORCH_INDEX_URL=https://download.pytorch.org/whl/cpu).

With conda, make install-conda creates the tsseg-env environment from environment.yml and installs tsseg in it (it needs conda in your PATH, or set in a .env file, see .env.example):

make install-conda
conda activate tsseg-env
Without TensorFlow

Only TSCP2Detector (tsseg[tscp2]) and SNLDSDetector (tsseg[snlds]) need TensorFlow. If it causes trouble on your platform, skip [all] and pick the extras you need:

pip install -e ".[torch,prophet,aeon,accelerators]"

Quick start

Segment a motion-capture recording, then score both results against its ground truth (the state detector needs pip install "tsseg[accelerators,aeon]"):

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]

Detectors accept NumPy arrays of shape (n_timepoints, n_channels) (or 1-D for univariate series), pandas Series and DataFrames. The getting started guide goes further.

Algorithms

Unsup.: runs without being told the number of change points or states. Guided: takes that number in its constructor (n_cps, n_states, …). 📦: needs an optional dependency (see Installation). Each name links to the documentation page of the detector.

Change point detection (22)
Detector Approach Unsup. Guided Reference
AMOC
AmocDetector
single best split ✓ Killick et al. (2012)
BEAST 📦
BeastDetector
Bayesian model averaging of trend and seasonality ✓ ✓ Zhao et al. (2019), RSE
BinSeg
BinSegDetector
greedy top-down splitting ✓ ✓ Bai (1997); Fryzlewicz (2014)
BOCD
BOCDDetector
Bayesian run-length posterior ✓ ✓ Adams & MacKay (2007)
BottomUp
BottomUpDetector
greedy bottom-up merging ✓ ✓ Keogh et al. (2001), ICDM
changeforest 📦
ChangeForestDetector
random forest classifier between segments ✓ ✓ Londschien et al. (2023), JMLR
ChangeFinder
ChangeFinderDetector
two-stage autoregressive outlier scores ✓ ✓ Takeuchi & Yamanishi (2006), TKDE
ClaSP 📦
ClaspDetector
classification score profile ✓ ✓ Ermshaus et al. (2023), DMKD
DynP
DynpDetector
exact dynamic programming ✓ Auger & Lawrence (1989)
E-Agglo 📦
EAggloDetector
agglomerative, energy distance ✓ Matteson & James (2014), JASA
ESPRESSO
EspressoDetector
entropy and shape of the matrix profile ✓ Deldari et al. (2020), UbiComp
FLUSS 📦
FLUSSDetector
arc curve of the matrix profile ✓ ✓ Gharghabi et al. (2017), ICDM
GGS
GreedyGaussianDetector
greedy Gaussian likelihood ✓ ✓ Hallac et al. (2019), ADAC
iCID
ICIDDetector
isolation distributional kernel ✓ Cao et al. (2024), JAIR
IGTS
InformationGainDetector
information gain, top-down ✓ ✓ Sadri et al. (2017), PMC
PELT
PeltDetector
exact penalised search with pruning ✓ Killick et al. (2012), JASA
Prophet 📦
ProphetDetector
trend change points of Prophet ✓ ✓ Taylor & Letham (2018)
RuLSIF
RuLSIFDetector
relative density-ratio estimation ✓ ✓ Liu et al. (2013), Neural Netw.
tGLAD 📦
TGLADDetector
changes of conditional independence graphs ✓ Imani & Shrivastava (2023)
TIRE 📦
TireDetector
autoencoder, time-invariant features ✓ ✓ De Ryck et al. (2021), IEEE TSP
TS-CP2 📦
TSCP2Detector
contrastive predictive coding ✓ ✓ Deldari et al. (2021), WWW
Window
WindowDetector
sliding-window discrepancy ✓ ✓ Basseville & Nikiforov (1993)
State detection (9)
Detector Approach Unsup. Guided Reference
AutoPlait 📦
AutoPlaitDetector
MDL-based regime mining ✓ Matsubara et al. (2014), SIGMOD
CLaP 📦
ClapDetector
classification label profile ✓ ✓ Ermshaus et al. (2024)
E2USD 📦
E2USDDetector
dual-view embeddings, clustering ✓ ✓ Lai et al. (2024), WWW
Gaussian HMM
GaussianHMMDetector
hidden Markov model fitted by EM ✓ ✓ Rabiner (1989)
HDP-HSMM
HdpHsmmDetector
Bayesian nonparametric semi-Markov model ✓ ✓ Johnson & Willsky (2013), JMLR
Hidalgo
HidalgoDetector
local intrinsic dimension ✓ Allegra et al. (2020), Sci. Rep.
SNLDS 📦
SNLDSDetector
switching nonlinear dynamical system (experimental) ✓ Dong et al. (2020), ICML
TICC
TiccDetector
Toeplitz inverse covariance clustering ✓ ✓ Hallac et al. (2017), KDD
Time2State 📦
Time2StateDetector
contrastive encoder, clustering ✓ ✓ Wang et al. (2023), SIGMOD

Also available: RandomDetector, a random baseline for both tasks.

Evaluation metrics

Every metric returns a dictionary with at least a "score" key: metric.compute(y_true, y_pred)["score"].

Change point detection, on sorted change point indices:

Metric What it measures
F1Score precision and recall of the detected change points, within a margin
GaussianF1Score F1 where each detection earns a reward that decays with its distance to the true change point
Covering how well the predicted segments cover the true ones
BidirectionalCovering covering in both directions, true to predicted and predicted to true
HausdorffDistance the largest distance from a change point to the nearest one of the other set

Tip: pass these metrics the length of the series: compute(y_true, y_pred, n_timepoints=len(X)).

State detection, on one label per time point:

Metric What it measures
AdjustedRandIndex (ARI), AdjustedMutualInformation (AMI), NormalizedMutualInformation (NMI) agreement between the two labellings, as clusterings
WeightedAdjustedRandIndex (WARI), WeightedNormalizedMutualInformation (WNMI) ARI and NMI with each time point weighted by its distance to the nearest true boundary
StateMatchingScore (SMS) matches predicted to true states, then scores four types of errors

WARI, WNMI and SMS come from Toward Interpretable Evaluation Measures for Time Series Segmentation (NeurIPS 2025).

Interactive demo

Open the demo in Hugging Face Spaces

The tsseg demo on Hugging Face Spaces runs in the browser: load a series, run segmentation algorithms, then compare and evaluate their results, with nothing to install.

Contributing

Bug reports, questions and new detectors are welcome in the issues. From a clone:

make test                                # run the test suite, as in CI (long)
make test PYTEST_ARGS="-k PeltDetector"  # run a selection of tests
make lint                                # ruff check + ruff format --check, as in CI
make docs                                # build the documentation, as in CI (needs tsseg[docs])

The contributing guide covers the development setup, the code style and the tests a new detector must pass.

Citation

If tsseg helps your work, please cite the ECML-PKDD 2026 paper (also available from GitHub's Cite this repository button, through CITATION.cff):

@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}
}

If you compare segmentation methods, or use the results of the TSB-SEG benchmark, please also cite:

@inproceedings{chavelli2026tsbseg,
  title     = {{TSB-SEG}: A Systematic Time-Series Segmentation Benchmark},
  author    = {Chavelli, F{\'e}lix and Ermshaus, Arik and Yang, Fan and Sch{\"a}fer, Patrick and Paparrizos, John and Boniol, Paul},
  booktitle = {Advances in Neural Information Processing Systems (NeurIPS), Evaluations and Datasets Track},
  year      = {2026}
}

If you use WARI, WNMI or SMS, please also cite:

@inproceedings{chavelli2025interpretable,
  title     = {Toward Interpretable Evaluation Measures for Time Series Segmentation},
  author    = {Chavelli, F{\'e}lix and Boniol, Paul and Thomazo, Micha{\"e}l},
  booktitle = {Advances in Neural Information Processing Systems},
  year      = {2025}
}

Each detector also cites its original paper on its documentation page.

Contributors

  • Félix Chavelli (Inria, ENS, Paris)
  • Arik Ermshaus (Humboldt-Universität, Berlin)
  • Fan Yang (The Ohio State University, Columbus)
  • Paul Boniol (Inria, ENS, Paris)
  • Patrick Schäfer (Humboldt-Universität, Berlin)
  • John Paparrizos (The Ohio State University, AUTh, Columbus)

License

tsseg is released under the AGPL-3.0.

Third-party components

Several algorithms bundle adapted or vendored code under their own licenses.

Components, licenses and sources
Component License Source
aeon (base, EAgglo, GGS, Hidalgo, HMM, IGTS) BSD-3 aeon-toolkit/aeon
ruptures/ (vendored v1.1.8) BSD-2 deepcharles/ruptures
bocd/ MIT hildensia/bayesian_changepoint_detection
beast/ (wraps Rbeast, not bundled) GPL-2.0-or-later zhaokg/Rbeast
clap/ (ClaSP / CLaP) BSD-3 ermshaua/claspy
ggs/ (adapted from aeon, itself from the authors' code) BSD-3 and BSD-2 aeon-toolkit/aeon; cvxgrp/GGS
icid/ GPLv3 IsolationKernel/iCID
patss/ MIT KU Leuven DTAI
rulsif/ (port of the authors' MATLAB code) MIT anewgithubname/change_detection
snlds/vendor/ Apache-2.0 google-research/snlds
tglad/vendor/ (uGLAD) Non-Commercial Harshs27/tGLAD
autoplait/ (translation of the authors' C code) not specified Matsubara et al.
e2usd/ not specified; parts Apache-2.0 and MIT AI4CTS/E2Usd; parts from White-Link/UnsupervisedScalableRepresentationLearningTimeSeries and thuml/Autoformer
espresso/ not specified cruiseresearchgroup/ESPRESSO
ticc/ BSD-2 davidhallac/TICC
time2state/ MIT; parts Apache-2.0 and MIT Lab-ANT/Time2State; parts from White-Link/UnsupervisedScalableRepresentationLearningTimeSeries and locuslab/TCN
tire/ not specified De Ryck, De Vos & Bertrand (KU Leuven)
tscp2/ not specified Cruise Research Group

Each directory above that bundles code under a published license contains a copy of it (LICENSE, or LICENCE in patss/). The aeon license is copied in eagglo/, ggs/, hidalgo/, hmm/ and igts/ (in ggs/, followed by the license of cvxgrp/GGS, from which aeon adapted its code), and in the opening comment of tsseg/algorithms/base.py, whose base classes are adapted from aeon. The sources marked not specified publish no license. The LICENSE files of time2state/ and e2usd/ also hold the licenses of the parts that these detectors take from other projects (the causal CNN encoder and Dataset class of Franceschi et al., 2019, partly from locuslab/TCN; the decomposition blocks of Autoformer), with the changes made to them; that of e2usd/ covers these parts only. Rbeast, which beast/ only wraps, is installed by tsseg[beast]; tsseg follows the license of its R package, GPL (>= 2), although its PyPI wheel declares MIT.

Metadata

Release files for tsseg 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tsseg 0.3.1
File Size Uploaded Provenance Actions
tsseg-0.3.1.tar.gz 2.4 MB With provenance Details for tsseg-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tsseg 0.3.1
File Interpreter ABI Platform Actions
tsseg-0.3.1-py3-none-any.whl Python 3 none any Details for tsseg-0.3.1-py3-none-any.whl

Total release size: 3.9 MB

Release files / tsseg-0.3.1.tar.gz

Download URL tsseg-0.3.1.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
820b71520ff7ec7767b30ae4bc5d31af3acb30d156b782ad3135130a5da7531f
BLAKE2b-256 checksum
How to use checksums
b5cb546c970317816c893a8895ae1fa555255a73b15f80b724365d0f637da0ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / tsseg-0.3.1-py3-none-any.whl

Download URL tsseg-0.3.1-py3-none-any.whl
Size 1.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
f03fe3f6b42c349c5af335d475696c5d0ba045d7f9eb043baea0ba8771e77ea3
BLAKE2b-256 checksum
How to use checksums
a0e228e1349a7cc95d7b81e6561400559b812c300d5c5218296d522d86bf40c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for tsseg 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tsseg-0.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page