Segmentation, Warping and Clustering of Multivariate Time Series in PythonThe mvtsa toolbox

Appendix C
Method index and migration

This appendix lists the methods of the book with their classes or functions in mvtsa and their origins, and explains how to move from the group’s earlier MATLAB implementations to the package. Group marks methods developed at the University of Pannonia, new methods introduced in this book; the others implement methods of the literature.

Method

API

Origin

Segmentation
   

PCA segmentation, T2 and Q costs (group)

PCASegmenter, CostPCA

[1, 2, 8]

Modified Gath–Geva fuzzy segmentation (group)

GGSegmenter

[2]

Kalman filtering and segmentation (group)

kalman_smoother + any segmenter

[3]

Dynamic-PCA segmentation (group)

DPCASegmenter, select_dpca_lag

[6, 46]

Recursive-PCA on-line segmentation (group)

RecursivePCASegmenter, RecursivePCA

[13, 81, 82]

Fisher-information segmentation (group)

FisherSegmenter

[11, 12, 14, 88]

Model-based energy segmentation (group)

CostRegression

[16]

Krzanowski neighbour merging

KrzanowskiSegmenter

[14, 21]

Costs L2, L1, Gaussian, linear, AR, kernel

get_cost, COSTS

[36, 72, 73]

Bottom-up, top-down, sliding window, SWAB

BottomUp, TopDown, SlidingWindow, SWAB

[76, 77, 78]

Optimal partitioning, PELT, penalty path

OptimalPartition, PELT, penalty_path

[24, 74, 75]

Merge tree, segmentogram, persistence (new)

MergeTree, plot_segmentogram

this book

Relative reduction rate, permutation test

select_n_segments

[8, 79]

Bayesian on-line change point detection

BOCPD

[25]

Sticky Gaussian HMM

GaussianHMMSegmenter

[91, 92]

Sparse Gaussian states

SparseGaussianStateSegmenter

[95]

Segment-then-cluster states (new)

StateSegmenter

after [93]

ClaSP, FLUSS (centred)

ClaSPSegmenter, FLUSSSegmenter

[27, 28]

Predictive homogeneity (new)

PredictiveSegmenter

after [96]

Consensus segmentation (new)

ConsensusSegmenter

this book

CUSUM, buffered streaming

CUSUMDetector, StreamSegmenter

[97]

   
Warping and similarity
   

Correlation-based DTW, SEGPCA (group)

CBDTW, segpca_distance

[4, 5]

Dynamic-PCA CBDTW (group)

CBDTW(lags=...)

[8]

MPLA, SPLA, MDPLA, tightness of warping (group)

PLADistance, tightness_of_warping

[7]

Episode alignment (group)

triangular_episodes, align_episodes

[9, 10, 58]

Riemannian and mixed segment distances, episode DTW (new)

LOCAL_DISTANCES, MixedSegmentDistance, episode_dtw

this book, with [94, 122, 123]

DTW, windows, step patterns, lower bounds

dtw, window_mask, lb_keogh, lb_kim

[40, 41, 102, 103]

DDTW, WDTW, ADTW, shapeDTW, FastDTW

ddtw, wdtw, adtw, shape_dtw, fast_dtw

[104, 105, 106, 107, 108]

Dependent and independent multivariate DTW

dtw, dtw_independent

[109, 110]

LCSS, EDR, ERP, TWED, MSM

lcss, edr, erp, twed, msm

[111, 112, 113, 114, 115]

Soft-DTW, divergence, GAK, SBD

soft_dtw, soft_dtw_divergence, gak, sbd

[29, 30, 117, 119]

DBA, soft-DTW barycenter, elastic ensemble

dba, soft_dtw_barycenter, ElasticEnsemble

[29, 33, 120]

   
Clustering, representation, visualization
   

Fuzzy Sammon mapping (group)

fuzzy_sammon

[18]

Neighbourhood-preservation trajectory clustering (group)

TrajectoryClustering

[19]

Six-sigma visibility graphs (group)

six_sigma_visibility_graph

[20]

Decision-tree description of regimes (group)

explain_states

[17]

k-Shape, DBA k-means, k-medoids, fuzzy c-medoids

KShape, TimeSeriesKMeans, KMedoids, FuzzyCMedoids

[30, 33, 130, 131]

Spectral, density-based, consensus clustering

SpectralClustering, DensityClustering, ConsensusClustering

[133, 134, 135, 136]

PAA, APCA, PLA, PIP, SAX, ABBA, SFA

paa, apca, pla, pip, sax, abba, sfa

[49, 50, 51, 52, 55, 56, 57]

Features, path signatures

extract_features, signature_features

after [60, 62, 63]

Visibility, recurrence, ordinal networks; images

visibility_graph, recurrence_network, ordinal_partition_network, gramian_angular_field

[64, 65, 66, 68, 70]

Matrix profile, k-NN profile

matrix_profile, knn_profile

[26, 71]

Migration from the MATLAB toolboxes

Two MATLAB implementations of the group’s methods are available on the MathWorks File Exchange: Correlation based dynamic time warping of multivariate time series (CBDTW) and Fuzzy clustering based time-series segmentation (the modified Gath–Geva algorithm). Table C.2 maps their main steps to the package. Three differences matter in practice. First, mvtsa standardizes explicitly and records the statistics in the fitted object, so that queries are segmented “according to the database”. Second, change points are the first samples of new segments (0-based), and the boundaries 0 and T are not listed. Third, the number of principal components can be a fraction of explained variance, resolved once on the whole series and then kept fixed for every segment, which keeps segment models comparable.

Table C.2. From the MATLAB toolboxes to mvtsa.

MATLAB step

mvtsa

bottom-up PCA segmentation of a series (T2 or Q cost)

PCASegmenter(n_segments, n_components, statistic="Q") or BottomUp("pca", ...)

segment PCA models and the 1 −sPCA cost matrix

segment_models, segment_local_cost

DTW of the segment sequences (CBDTW)

CBDTW(...) .fit(collection) .pairwise()

SEGPCA baseline

CBDTW(..., warping=False), segpca_distance

precision–recall evaluation of retrieval

precision_recall_curve_knn, plot_precision_recall

modified Gath–Geva fuzzy segmentation with compatible merging

GGSegmenter(n_segments, n_components, merge=True)

fuzzy memberships and segment models

memberships_, models_, centers_t_, sigmas_t_