Skip to main content

mvtsa: segmentation, warping and clustering of multivariate time series

mvtsa: segmentation, warping and clustering of multivariate time series

tests docs book PyPI DOI License: MIT

mvtsa cuts multivariate time series into homogeneous segments, compares series whose time axes do not agree, and groups them. It implements the segmentation and warping methods developed by the group of János Abonyi at the University of Pannonia over two decades — PCA and dynamic-PCA segmentation, the modified Gath–Geva fuzzy segmentation, recursive-PCA on-line segmentation, Fisher-information segmentation for experiment design, correlation-based dynamic time warping, mixed piecewise-linear measures and episode alignment — next to the strongest methods of the field and several new ones, with tools to evaluate, validate, explain, simplify and operate the resulting models.

Module Contents
mvtsa.segmentation costs (L2, L1, Gaussian, linear, AR, kernel, PCA T²/Q, regression) × searches (bottom-up with a merge hierarchy, top-down, sliding window, SWAB, optimal partitioning, PELT, window discrepancy); PCA, dynamic-PCA, Krzanowski and recursive-PCA segmentation; modified Gath–Geva fuzzy segmentation; Fisher-information segmentation; BOCPD; sticky Gaussian HMM; sparse Gaussian states; ClaSP; FLUSS; segment-then-cluster states; predictive homogeneity with any scikit-learn model; consensus; streaming and CUSUM; selection of the number of segments
mvtsa.warping DTW with windows, step patterns, penalties and lower bounds; DTW_I, DDTW, WDTW, ADTW, shapeDTW, FastDTW, subsequence DTW; LCSS, EDR, ERP, TWED, MSM; soft-DTW and its divergence, GAK, SBD; correlation-based DTW (static and dynamic PCA, Riemannian and mixed segment distances); MPLA/SPLA/MDPLA; episode alignment and episode DTW; DBA and soft-DTW barycenters; path statistics, tightness of warping, window learning, elastic ensemble
mvtsa.clustering k-means (Euclidean, DBA, soft-DTW), k-Shape, k-medoids, fuzzy c-medoids, hierarchical, spectral, DBSCAN/HDBSCAN, consensus; feature- and signature-based, segment and trajectory clustering
mvtsa.representation PCA, PPCA, recursive PCA, similarity factors (Krzanowski, λ, Eros), principal angles, SPD geometry; PAA, APCA, PLA, PIP, SAX, ABBA, SFA; triangular episodes; features and path signatures; visibility, six-sigma, ordinal and recurrence networks; recurrence plots, GAF, MTF; matrix and k-NN profiles
mvtsa.evaluation F1 with margin, covering, Hausdorff, annotation error, state ARI/AMI; clustering scores, silhouette, Dunn, partition coefficient; k-NN accuracy, precision–recall curves, mAP; stability, sensitivity, Friedman–Nemenyi, Wilcoxon–Holm; benchmarks and grid search
mvtsa.simplify, mvtsa.explain merging short segments, pruning, hierarchy reduction, PLA simplification, compression; variable contributions, segment tables, decision-tree rules of states, regime transition networks
mvtsa.mlops JSON/YAML configurations, analysis pipelines, model files with checksums and data fingerprints, a model registry with stages, experiment tracking (local, optional MLflow), data contracts, drift monitoring, model cards; command line mvtsa
mvtsa.viz segmented series, fuzzy memberships, segmentograms, cost curves, PCA statistics and loadings, alignments, cost matrices, alignment uncertainty, prototypes, dendrograms, Sammon and fuzzy Sammon maps, critical-difference diagrams, stability plots, dashboards
mvtsa.datasets generators (piecewise stationary, correlation switching, dynamic switching, recurring regimes, energy, CBF, synthetic control, signatures, motion, correlation and dynamic sequences); pH and MMA polymerization reactor simulators; bundled BasicMotions, JapaneseVowels and GunPoint; UEA & UCR and TSSB fetchers

Installation

pip install mvtsa              # numpy, scipy, pandas, scikit-learn, matplotlib, networkx
pip install "mvtsa[fast]"      # + numba for the dynamic-programming kernels
pip install "mvtsa[all]"       # + MLflow, YAML, ruptures, stumpy

Quick start

import mvtsa as mv

# segmentation: four regimes that differ only in their correlation structure
X, cps, _ = mv.datasets.make_correlation_switching(n_segments=4, length=150)
seg = mv.segment(X, "pca", n_segments=4, n_components=1)        # Q statistic, bottom-up
print(seg.change_points, cps)                                    # [150 300 450] [150 300 450]
mv.viz.plot_segmentation(X, seg, truth=cps)

# warping: correlation-based DTW of on-line signatures
C, writer = mv.datasets.make_signatures(n_writers=6, n_per_writer=8)
D = mv.warping.CBDTW(n_segments=10, n_components=2).fit(C).pairwise()
print(mv.evaluation.knn_accuracy(D, writer))

# clustering on the same distances
labels = mv.clustering.KMedoids(6, metric="precomputed").fit(D).labels_

Documentation and book

Citing

J. Abonyi, mvtsa: segmentation, warping and clustering of multivariate time series in Python, 2026. Zenodo, doi:10.5281/zenodo.24646850 (all versions; version 1.0 is doi:10.5281/zenodo.24646851) — together with the original publications of the methods you use (see CITATION.cff and the method lineage page of the documentation).

Acknowledgement

The research summarized in this package was supported by the National Research, Development and Innovation Office of Hungary (NKFIH) through the OTKA 143482 project. The package is maintained by the Complex Systems Intelligence group (abonyilab.com) of the University of Pannonia, Veszprém.

License

MIT (software); the book is published under CC BY 4.0.

Metadata

Release files for mvtsa 1.0.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 mvtsa 1.0.1
File Size Uploaded Provenance Actions
mvtsa-1.0.1.tar.gz 901.7 kB With provenance Details for mvtsa-1.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 1.8 MB

Release files / mvtsa-1.0.1.tar.gz

Download URL mvtsa-1.0.1.tar.gz
Size 901.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6efcd418f30eb0aa601bbdd9bbf782ebc30993c4ff407bd25e29c45290caa74e
BLAKE2b-256 checksum
How to use checksums
880817c1f7d4aa3d7b85028b3e616d1c9fe7c3cc2d40c45186842b8b16a3767a
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 29, 2026.

Transparency log

Release files / mvtsa-1.0.1-py3-none-any.whl

Download URL mvtsa-1.0.1-py3-none-any.whl
Size 892.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a52b7d53d0c5caa0ed6b413ed68dead3ce62870e24af7b4ea174df935bea114
BLAKE2b-256 checksum
How to use checksums
6afa4da068824ba9d27a65f95f0a531744815eeab92145a6a7c625685d2e7364
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 29, 2026.

Transparency log

Security for mvtsa 1.0.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 mvtsa-1.0.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 29, 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.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files Full provenance

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