Skip to main content

A library for time series segmentation

Project description

tsseg - Time Series Segmentation

tsseg logo

Python 3.10+ Version 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, axis=0)
y_pred = segmenter.predict(X)

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

📖 Documentation: fchavelli.github.io/tsseg

Installation

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 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
tirex/ (via tsseg-tirex) NXAI Community License NX-AI/tirex
autoplait/ not specified Matsubara et al.
e2usd/ not specified AI4CTS/E2Usd
espresso/ not specified cruiseresearchgroup/ESPRESSO
ticc/ not specified davidhallac/TICC
time2state/ not specified 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. The TiRex integration is built with technology from NXAI.

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.0.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.0-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tsseg-0.1.0.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for tsseg-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d977f13c47214a75f4dd7da40f7d4e58d32ed33d1abf52b0f0a631db61bbba5d
MD5 f0eb789b7dceeb995fc7ada48ce9880a
BLAKE2b-256 08aad199169862335504e7e25d17f3d2ced004613c9ad4b8d57569762e716c7a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tsseg-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for tsseg-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb76a7e74f2cc7dd6d52b0f18f490339dbc8d22b0459872f84b141f16c358468
MD5 55e23545b951da1a97952dbc2471d432
BLAKE2b-256 410a7b5cc923f1dca84dde14e572f5580c4f66b822c625036c8b538c69f303e7

See more details on using hashes here.

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