Metadata-Version: 2.5
Name: mvtsa
Version: 1.0.1
Summary: Multivariate time series analysis: segmentation (PCA, dynamic PCA, recursive PCA, fuzzy, Fisher-information, cost-based, Bayesian, HMM, self-supervised, consensus), elastic similarity and warping (DTW family, correlation-based DTW, MDPLA, soft-DTW, edit distances, episode alignment), clustering, representations, evaluation, visualization and MLOps tools.
Project-URL: Homepage, https://github.com/ComplexSystemsIntelligence/mvtsa
Project-URL: Documentation, https://complexsystemsintelligence.github.io/mvtsa
Project-URL: Repository, https://github.com/ComplexSystemsIntelligence/mvtsa
Project-URL: Issues, https://github.com/ComplexSystemsIntelligence/mvtsa/issues
Project-URL: Changelog, https://github.com/ComplexSystemsIntelligence/mvtsa/blob/main/CHANGELOG.md
Project-URL: Book (PDF), https://complexsystemsintelligence.github.io/mvtsa/mvtsa-book.pdf
Author-email: János Abonyi <janos@abonyilab.com>
License-Expression: MIT
License-File: LICENSE
Keywords: MLOps,change point detection,correlation-based dynamic time warping,dynamic PCA,dynamic time warping,elastic distances,multivariate time series,principal component analysis,process monitoring,segmentation,state detection,time series,time series clustering
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.10
Requires-Dist: matplotlib>=3.7
Requires-Dist: networkx>=3.0
Requires-Dist: numpy>=1.24
Requires-Dist: pandas>=2.0
Requires-Dist: scikit-learn>=1.3
Requires-Dist: scipy>=1.11
Provides-Extra: all
Requires-Dist: mlflow>=2.8; extra == 'all'
Requires-Dist: numba>=0.58; extra == 'all'
Requires-Dist: plotly>=5.15; extra == 'all'
Requires-Dist: pyyaml>=6.0; extra == 'all'
Requires-Dist: ruptures>=1.1; extra == 'all'
Requires-Dist: stumpy>=1.12; extra == 'all'
Provides-Extra: book
Requires-Dist: beautifulsoup4>=4.12; extra == 'book'
Requires-Dist: lxml; extra == 'book'
Requires-Dist: numba>=0.58; extra == 'book'
Requires-Dist: pillow; extra == 'book'
Requires-Dist: pyyaml>=6.0; extra == 'book'
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: myst-parser; extra == 'dev'
Requires-Dist: numba>=0.58; extra == 'dev'
Requires-Dist: numpydoc; extra == 'dev'
Requires-Dist: pydata-sphinx-theme; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest>=7; extra == 'dev'
Requires-Dist: pyyaml>=6.0; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Requires-Dist: sphinx-copybutton; extra == 'dev'
Requires-Dist: sphinx-design; extra == 'dev'
Requires-Dist: sphinx-gallery>=0.15; extra == 'dev'
Requires-Dist: sphinx>=7; extra == 'dev'
Requires-Dist: twine; extra == 'dev'
Provides-Extra: docs
Requires-Dist: myst-parser; extra == 'docs'
Requires-Dist: numba>=0.58; extra == 'docs'
Requires-Dist: numpydoc; extra == 'docs'
Requires-Dist: pydata-sphinx-theme; extra == 'docs'
Requires-Dist: sphinx-copybutton; extra == 'docs'
Requires-Dist: sphinx-design; extra == 'docs'
Requires-Dist: sphinx-gallery>=0.15; extra == 'docs'
Requires-Dist: sphinx>=7; extra == 'docs'
Provides-Extra: fast
Requires-Dist: numba>=0.58; extra == 'fast'
Provides-Extra: interactive
Requires-Dist: plotly>=5.15; extra == 'interactive'
Provides-Extra: interop
Requires-Dist: ruptures>=1.1; extra == 'interop'
Requires-Dist: stumpy>=1.12; extra == 'interop'
Provides-Extra: mlops
Requires-Dist: mlflow>=2.8; extra == 'mlops'
Requires-Dist: pyyaml>=6.0; extra == 'mlops'
Provides-Extra: test
Requires-Dist: pytest-cov; extra == 'test'
Requires-Dist: pytest>=7; extra == 'test'
Requires-Dist: pyyaml>=6.0; extra == 'test'
Description-Content-Type: text/markdown

<p align="center"><img src="https://raw.githubusercontent.com/ComplexSystemsIntelligence/mvtsa/main/docs/_static/banner.png" alt="mvtsa: segmentation, warping and clustering of multivariate time series"></p>

# mvtsa: segmentation, warping and clustering of multivariate time series

[![tests](https://github.com/ComplexSystemsIntelligence/mvtsa/actions/workflows/ci.yml/badge.svg)](https://github.com/ComplexSystemsIntelligence/mvtsa/actions/workflows/ci.yml)
[![docs](https://img.shields.io/badge/docs-gallery%20%2B%20API-285780)](https://complexsystemsintelligence.github.io/mvtsa)
[![book](https://img.shields.io/badge/book-PDF%20%C2%B7%20EPUB%20%C2%B7%20web-D55E00)](https://complexsystemsintelligence.github.io/mvtsa/book.html)
[![PyPI](https://img.shields.io/pypi/v/mvtsa.svg)](https://pypi.org/project/mvtsa/)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.24646850.svg)](https://doi.org/10.5281/zenodo.24646850)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/ComplexSystemsIntelligence/mvtsa/blob/main/LICENSE)

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

```bash
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

```python
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

* Documentation, gallery of 48 examples and API reference:
  <https://complexsystemsintelligence.github.io/mvtsa>
* Book *Segmentation, Warping and Clustering of Multivariate Time Series in
  Python* (PDF, EPUB, web), built from the same example scripts:
  <https://complexsystemsintelligence.github.io/mvtsa/book.html>

## Citing

J. Abonyi, *mvtsa: segmentation, warping and clustering of multivariate time
series in Python*, 2026. Zenodo, [doi:10.5281/zenodo.24646850](https://doi.org/10.5281/zenodo.24646850)
(all versions; version 1.0 is [doi:10.5281/zenodo.24646851](https://doi.org/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](https://www.abonyilab.com)) of the
University of Pannonia, Veszprém.

## License

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