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 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, version 1.0, 2026 — 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

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

Built distribution (wheel)

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

Total release size: 1.8 MB

Release files / mvtsa-1.0.tar.gz

Download URL mvtsa-1.0.tar.gz
Size 901.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b3109d5c1a060ca42d2344deb5e07daebc53457efe5194f81c157f27a93b3c4e
BLAKE2b-256 checksum
How to use checksums
ece9d5fb67981eef68af51c1895df8280fb9c00cef85127379bc223ffc5c830c
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-py3-none-any.whl

Download URL mvtsa-1.0-py3-none-any.whl
Size 892.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34e9a09dbcff2f4e645e27018bcfc4f8ffc95456a594a77222c95b806c3835e2
BLAKE2b-256 checksum
How to use checksums
5df0ecafdf88b27f775616f3702cdefbb268a2462e1bb39372c7d8901adbc9fe
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

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.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 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