Skip to main content

tsmotifs

tsmotifs is an open-source Python framework for time-series motif discovery. It accompanies a systematic review and benchmark project and provides a shared implementation surface for comparing motif discovery methods without replacing their original scientific definitions.

The project is intended for researchers and practitioners who need consistent algorithm interfaces, reproducible experiment execution, and common evaluation utilities across a broad and otherwise fragmented literature.

Main features

  • A common MotifFinder interface and shared motif result representation.
  • Integrations and reconstructions spanning several families of motif discovery methods.
  • Versioned configuration, manifest generation, and runners for reproducible experiments.
  • Common result serialization, aggregation, and interval-based evaluation support.

Installation

Install the core library from PyPI:

pip install tsmotifs

Some methods need additional dependencies. Install the relevant extra when required:

pip install "tsmotifs[integrations]"
pip install "tsmotifs[visualization]"
pip install "tsmotifs[deep]"

The benchmark runners and their configurations are distributed in the source repository. For benchmark reproduction or development, clone the repository and install it in editable mode:

git clone https://github.com/kdis-lab/tsmotifs.git
cd tsmotifs
python -m pip install -e ".[benchmark]"

Use python -m pip install -e ".[dev]" to include the test and release-development tools.

Quick start

The following example uses the registered MK implementation on a small series containing a repeated subsequence:

import numpy as np

from tsmotifs import MK

series = np.array(
    [0, 1, 0, -1, 0, 1, 0, -1, 2, 2, 0, 1, 0, -1],
    dtype=float,
)

finder = MK(window_size=4)
motifs = finder.fit_discover(series, top_k=1)

for motif in motifs:
    print(motif.start, motif.length, motif.matches, motif.distance)

The common interface also exposes fit() and discover() separately. Use tsmotifs.list_algorithms() to inspect the algorithms bootstrapped into the public registry.

Supported methods

The repository covers exact, approximate, symbolic, grammar-based, probabilistic, online, optimization/learning, segmentation, and deep-learning approaches. Coverage reflects the scope of the accompanying review; individual integrations can have method-specific dependencies, input constraints, or external runtime requirements.

The top-level registry is deliberately conservative so that import tsmotifs remains safe when optional dependencies are absent. The benchmark configuration under experiment/config/ is the source of truth for methods used in each experimental phase.

Reproducibility

The experiment/ tree contains the versioned configurations, manifest builders, execution runners, aggregation code, and Slurm support used by the review benchmark. See the experimental pipeline and the HPC runbook before reproducing experiments.

Benchmark datasets and generated results are intentionally not part of the PyPI wheel. A link to the companion project website and the paper's final bibliographic record will be added when they are public; until then, this repository is the canonical supporting software artifact.

Citation

If you use tsmotifs, cite the associated review paper once its bibliographic record is available and cite the software version used in your experiments. Machine-readable software citation metadata is provided in CITATION.cff.

Contributing

Bug reports, documentation improvements, packaging fixes, and carefully scoped algorithm integrations are welcome. Please read CONTRIBUTING.md before opening an issue or pull request. Changes that affect taxonomy, evaluation methodology, or benchmark protocols require explicit scientific review.

License

tsmotifs is distributed under the BSD 3-Clause License.

Metadata

Release files for tsmotifs 0.1.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 tsmotifs 0.1.1
File Size Uploaded
tsmotifs-0.1.1.tar.gz 1.1 MB Details

Built distribution (wheel)

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

Total release size: 2.3 MB

Release files / tsmotifs-0.1.1.tar.gz

Download URL tsmotifs-0.1.1.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
c96c3ab60e73391fcf23686257a3fa4ba126df0f861a87ab034343468d8b7180
BLAKE2b-256 checksum
How to use checksums
0b2f1156356a38908b9b79b7e56725ce46a55ea567898b94168629f80893bb16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / tsmotifs-0.1.1-py3-none-any.whl

Download URL tsmotifs-0.1.1-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ff28d9e2fe38c70bb86c19cf50ce3f5ec86f62c72ba7d3b69d12e52389ea722a
BLAKE2b-256 checksum
How to use checksums
45ea56ffeb1f74d6c782c0950e1d832c08c3b60b7f07e3a6c9f4fe53cda6cc99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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