Skip to main content

tsseg logo

tsseg: 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 | 3.13 | 3.14 CI status Documentation Interactive demo on Hugging Face Spaces License: AGPL-3.0 Ruff

Documentation · Examples · Live demo · Detectors · Taxonomy · 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 unifies algorithms for time series segmentation behind a single API, with evaluation metrics and an exploratory interactive demo. 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, …]

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

  • 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.
  • Metrics for both tasks. F1 score, covering score, and their soft and bidirectionnal variants 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
    1. evaluates 26 tsseg detectors on 592 series from 8 datasets, for both tasks.
  • 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[l1tf] OSQP TrendFilteringDetector
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.

On Python 3.14, tsseg[all] leaves out tsseg[tscp2] and tsseg[snlds]: TensorFlow has no stable release for it yet, nor tf-keras any release, so TSCP2Detector and SNLDSDetector need Python 3.10 to 3.13 for now. 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.

Examples

The examples apply tsseg to public data, from the narrative voice of Jekyll and Hyde and the storm surge of Hurricane Sandy to a night of sleep recordings, and compare each result with a reference the detector never sees. They run offline from a source checkout:

python -m examples.gallery.jekyll
python -m examples.gallery.run_all --output /tmp/tsseg-gallery

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. The interactive taxonomy places them by how they search for a segmentation and by what makes a segment homogeneous, with filters and search.

Change point detection (23)
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
Offline Gaussian MAP partition, full covariance ✓ ✓ Fearnhead (2006); Fearnhead & Liu (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.
SST
SSTDetector
subspaces of past and future Hankel matrices ✓ Idé & Tsuda (2007), SDM; Weber & Lenz (2025), IEEE Access
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 (10)
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.
Laplacian
LaplacianDetector
spectral clustering of a recurrence graph of windows ✓ ✓ McFee & Ellis (2014), ISMIR
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.

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)
The sample dataset of the demo, a motion-capture recording bundled with tsseg: ground truth (top), change points of BottomUp, unsupervised (middle), and states of Time2State, told the number of states (bottom), each scored against the truth.

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, Columbus; Aristotle University of Thessaloniki)

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
laplacian/ (recurrence and diagonal median filter from librosa; Louvain from NetworkX) ISC; BSD-3 librosa/librosa; networkx/networkx
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.4.0

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.4.0
File Size Uploaded Provenance Actions
tsseg-0.4.0.tar.gz 2.7 MB With provenance Details for tsseg-0.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 4.2 MB

Release files / tsseg-0.4.0.tar.gz

Download URL tsseg-0.4.0.tar.gz
Size 2.7 MB
Tags Source
SHA-256 checksum
How to use checksums
7bc3b0a801b97d89beb64c75c77d49b2a7896905a14a10684792ce9908667a80
BLAKE2b-256 checksum
How to use checksums
f90729481608d8ea70d6a06ba89a92950355d634e05d7d70b2e227c0760bab3c
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 18, 2026.

Transparency log

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

Download URL tsseg-0.4.0-py3-none-any.whl
Size 1.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
6855245a866420c8528c17078f4da005d49b5b9d7f47e27e6339ae04489d142f
BLAKE2b-256 checksum
How to use checksums
aefa4baf65c5bebae37b38cb32ce14c2a976269c6c1277b76baee38383645fd5
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 18, 2026.

Transparency log

Security for tsseg 0.4.0

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.4.0.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 18, 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