Skip to main content

A library for time series segmentation

Project description

tsseg - Time Series Segmentation

tsseg logo

PyPI Python 3.10+ Ruff Documentation License

tsseg is a Python library for Time Series Segmentation, covering both Change Point Detection and State Detection. It bundles 30+ segmentation algorithms, evaluation metrics, data loaders, and real-world benchmark datasets under a unified API.

Segmentation algorithms share the same base class interface as the aeon time series toolkit, making them interoperable with the broader aeon ecosystem. Several aeon segmenters are also re-exposed through tsseg for convenience.

Quick Start

from tsseg.data.datasets import load_mocap
from tsseg.algorithms import ClapDetector
from tsseg.metrics import StateMatchingScore

# Load a time series
X, y_true = load_mocap(trial=0)

# Segment
segmenter = ClapDetector()
segmenter.fit(X)
y_pred = segmenter.predict(X)

# Evaluate
score = StateMatchingScore().compute(y_true, y_pred)
print(f"SMS: {score['score']:.4f}")

📖 Documentation: fchavelli.github.io/tsseg

Interactive Demo

An interactive demo of tsseg is available here, powered by Hugging Face Spaces. You can use it directly in your browser to load data, run segmentation algorithms, compare, and evaluate results.

Screenshot of the tsseg interactive demo

Installation

From PyPI

pip install tsseg

With optional extras:

pip install tsseg[torch]       # PyTorch-based detectors
pip install tsseg[all]         # all optional dependencies

From source

Requires: conda in your PATH (or set it in a .env file — see .env.example).

git clone https://github.com/fchavelli/tsseg.git
cd tsseg
make install          # creates the conda env + installs tsseg
conda activate tsseg-env
Manual installation
conda env create -f environment.yml
conda activate tsseg-env
pip install -e .[all]
Lightweight install (no TensorFlow)

If TensorFlow causes issues on your platform, skip the [all] extra and install only the pieces you need:

conda env create -f environment.yml
conda activate tsseg-env
pip install -e .[torch,prophet,aeon]   # pick only the extras you want

Only TSCP2Detector requires TensorFlow (tsseg[tscp2]). All other 27+ algorithms work without it.

Optional extras

Most detectors work out of the box. Heavier dependencies are opt-in:

Extra What it adds
tsseg[aeon] Compatibility helpers for the aeon ecosystem
tsseg[prophet] Facebook Prophet (ProphetDetector)
tsseg[patss] Bayesian HSMM dependencies (PatssDetector)
tsseg[torch] PyTorch-based detectors (TireDetector, Time2StateDetector)
tsseg[tglad] PyTorch + NetworkX (TGLADDetector)
tsseg[tscp2] TensorFlow + TCN layer (TSCP2Detector)
tsseg[accelerators] Numba / Cython speedups
tsseg[docs] Sphinx doc toolchain
tsseg[all] Everything above

Contributing

make test       # run the test suite
make lint       # check style and linting rules with Ruff
make docs       # build the documentation locally

See the Contributing Guide for full instructions.

License

AGPLv3 — see the LICENSE file for details.

Third-party components

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

Component License Source
aeon (base, EAgglo, Hidalgo, HMM, IGTS) BSD-3 aeon-toolkit/aeon
ruptures/ (vendored v1.1.8) BSD-2 deepcharles/ruptures
bocd/ Apache-2.0 hildensia/bayesian_changepoint_detection
clap/ (ClaSP / CLaP) BSD-3 ermshaua/clasp
ggs/ BSD-2 cvxgrp/GGS
icid/ GPLv3 IsolationKernel/iCID
patss/ MIT KU Leuven DTAI
tglad/vendor/ (uGLAD) Non-Commercial Harshs27/tGLAD
autoplait/ not specified Matsubara et al.
e2usd/ not specified AI4CTS/E2Usd
espresso/ not specified cruiseresearchgroup/ESPRESSO
ticc/ BSD-2 davidhallac/TICC
time2state/ MIT Lab-ANT/Time2State
tire/ not specified De Ryck, De Vos & Bertrand (KU Leuven)
tscp2/ not specified Cruise Research Group

Each vendored directory contains a LICENSE file with full terms.

Contributors

  • Felix 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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tsseg-0.1.1.tar.gz (2.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tsseg-0.1.1-py3-none-any.whl (1.4 MB view details)

Uploaded Python 3

File details

Details for the file tsseg-0.1.1.tar.gz.

File metadata

  • Download URL: tsseg-0.1.1.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tsseg-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3408a7db1941b27e817101cb298e7e9ccbec395e0e64060b2d38b0c5a25c154a
MD5 14a150b4ff8772afb0faf2b05c8e4311
BLAKE2b-256 94e24211ba08aacca4efa5aaae853fae48727bec9d2f73972964403f10c46269

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsseg-0.1.1.tar.gz:

Publisher: ci.yml on fchavelli/tsseg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tsseg-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: tsseg-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tsseg-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d52943d7c989a569c069cc762b3db9d0abeea4065f05e5b625e05e4ec276a695
MD5 bd9b46f4506ef8be88a9c01954505cbb
BLAKE2b-256 e4fec10b780abeaf30e882e4b6a59e3d6ac36662cc2bfb547ca3cf5659d7b586

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsseg-0.1.1-py3-none-any.whl:

Publisher: ci.yml on fchavelli/tsseg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page