Appendix A
API reference
This appendix lists every public class and function of mvtsa, module by module, with the first sentence of its docstring. The lists are generated from the __all__ attribute of each module by book/build_api_appendix.py, so they are complete by construction; the full signatures, parameters, and attributes are in the online documentation and in the docstrings (help(mvtsa.segmentation.PCASegmenter)). The conventions of the API are described in section 2.6, the notation of the docstrings in table 2.1.
A.1 mvtsa: Core objects and shortcuts
|
Name | Kind |
Description |
|
||
|
Segmentation | class |
A segmentation of one series |
|
as_series | function |
Return X as a 2-D float array (T, n) |
|
as_collection | function |
Return a collection of series as a list of (T_i, n) arrays |
|
segment | function |
One-line segmentation: segment(X, "pca", n_segments=4) |
|
pairwise_distances | function |
Distance matrix of a collection (or between two collections) |
|
segmentation | module |
subpackage, see section mvtsa.segmentation |
|
warping | module |
subpackage, see section mvtsa.warping |
|
clustering | module |
subpackage, see section mvtsa.clustering |
|
representation | module |
subpackage, see section mvtsa.representation |
|
evaluation | module |
subpackage, see section mvtsa.evaluation |
|
viz | module |
subpackage, see section mvtsa.viz |
|
mlops | module |
subpackage, see section mvtsa.mlops |
|
datasets | module |
subpackage, see section mvtsa.datasets |
|
preprocessing | module |
subpackage, see section mvtsa.preprocessing |
|
distances | module |
subpackage, see section mvtsa.distances |
|
simplify | module |
subpackage, see section mvtsa.simplify |
|
explain | module |
subpackage, see section mvtsa.explain |
|
io | module |
subpackage, see section mvtsa.io |
|
__version__ | constant |
str constant |
|
||
|
||
|
||
|
||
|
||
A.2 mvtsa.preprocessing: Preprocessing
|
Name | Kind |
Description |
|
||
|
zscore | function |
Z-normalize every variable (zero mean, unit standard deviation) |
|
minmax | function |
Scale every variable to feature_range |
|
robust_scale | function |
Center by the median and scale by the interquartile range |
|
Standardizer | class |
Fit-once, apply-many standardization (for pipelines and deployment) |
|
resample | function |
Resample a series to length samples by interpolation over [0, 1] |
|
resample_collection | function |
Resample every series of a collection to a common length |
|
fill_missing | function |
Fill NaN values column-wise by "linear" interpolation, "ffill" (last observation carried forward) or "mean" |
|
moving_average | function |
Centered moving average (edges use the available samples) |
|
smooth | function |
Smooth every variable: "savgol" (Savitzky–Golay), "gaussian" or "moving" average |
|
derivative | function |
First or second derivative per sample ("gradient" = central differences, "savgol" = Savitzky–Golay derivative filter) |
|
keogh_derivative | function |
Derivative estimate of Keogh and Pazzani (2001) used by derivative DTW: d_t = ((x_t - x_{t-1}) + (x_{t+1} - x_{t-1}) / 2) / 2; the end values copy their neighbo |
|
dynamize | function |
Lag-extended data matrix of dynamic PCA (Ku, Storer and Georgakis, 1995) |
|
delay_embedding | function |
Delay-coordinate embedding of a univariate series (Takens): rows [x(t), x(t+tau), ..., x(t+(dim-1)tau)] |
|
ami_lag | function |
Embedding delay at the first minimum of the average mutual information (Fraser and Swinney, 1986) |
|
false_nearest_neighbors | function |
Embedding dimension by the false nearest neighbour method of Kennel, Brown and Abarbanel (1992) |
|
kalman_smoother | function |
Linear Kalman filter and Rauch–Tung–Striebel smoother |
|
detrend | function |
Remove a polynomial trend of the given order from every variable |
|
||
|
||
|
||
|
||
|
||
A.3 mvtsa.representation: Representations
|
Name | Kind |
Description |
|
||
|
PCAModel | class |
Principal component model with monitoring statistics |
|
PPCAModel | class |
Probabilistic PCA (Tipping and Bishop, 1999) |
|
RecursivePCA | class |
Recursive (exponentially weighted) PCA with a variable forgetting factor |
|
select_dpca_lag | function |
Number of lags of dynamic PCA |
|
resolve_n_components | function |
Number of retained components |
|
krzanowski_similarity | function |
Krzanowski’s PCA similarity factor (1979): |
|
lambda_similarity | function |
Eigenvalue-weighted PCA similarity factor (Johannesmeyer, 1999; Singhal and Seborg, 2002) |
|
eros_similarity | function |
Eros, the extended Frobenius norm similarity of Yang and Shahabi (2004): over corresponding eigenvectors |
|
eros_weights | function |
Eros weights (Yang and Shahabi, 2004): the normalized eigenvalue profiles averaged over a learning set, renormalized to sum to one |
|
principal_angles | function |
Principal angles (radians, increasing) between the column spaces of U1 and U2 (orthonormalized internally) |
|
grassmann_distance | function |
Geodesic (arc-length) distance on the Grassmann manifold: |
|
chordal_distance | function |
Projection (chordal) distance |
|
mean_distance_similarity | function |
Distance similarity factor of Singhal and Seborg (2005): the probability that the Mahalanobis distance between the means is exceeded under a standard normal ref |
|
log_euclidean_distance | function |
(Arsigny et al., 2007) |
|
affine_invariant_distance | function |
(Pennec et al., 2006) |
|
bures_wasserstein_distance | function |
, the 2-Wasserstein distance of two centered Gaussi |
|
gaussian_w2_distance | function |
2-Wasserstein distance between and |
|
gaussian_jeffreys_divergence | function |
Symmetric Kullback–Leibler (Jeffreys) divergence of two Gaussians |
|
spd_mean | function |
Mean of SPD matrices: "log_euclidean" (closed form) or "euclidean" |
|
paa | function |
PAA of every variable: (n_segments, n) frame means (frames of nearly equal length when T is not divisible) |
|
inverse_paa | function |
Step-function reconstruction of a PAA representation |
|
apca | function |
APCA: bottom-up segmentation with the L2 cost (segment means are Segmentation.to_frame(X)) |
|
PLA | class |
Piecewise linear approximation of a (multivariate) series |
|
pla | function |
Piecewise linear approximation |
|
pip | function |
Indices of the k perceptually important points of a univariate series: start with the end points and repeatedly add the point farthest from the line joining its |
|
SAX | class |
SAX transform with n_segments PAA frames and alphabet_size symbols |
|
sax | function |
Shorthand for SAX(n_segments, alphabet_size).transform(x) |
|
abba | function |
ABBA symbolic representation of a univariate series |
|
sfa | function |
SFA word of a univariate series: the first n_coefficients real/imaginary DFT values discretized by per-coefficient breakpoints (equi-depth bins learned from the |
|
Episode | class |
One episode: primitive code, half-open sample range and magnitude (signed change of the signal over the episode) |
|
triangular_episodes | function |
Episode sequence of a univariate signal |
|
episode_string | function |
The primitive codes of an episode sequence as a string |
|
size_classes | function |
Size class ("small", "medium", "large") of every episode from its duration and absolute magnitude |
|
multivariate_episodes | function |
Episodes of a multivariate signal: of the first principal component (method="pca", as in Balaskó et al., 2007) or of every variable ("each", returns a list of s |
|
PRIMITIVES | constant |
Letters of the seven qualitative episode primitives |
|
DIRECTION | constant |
dict constant |
|
QTA_SUBSTITUTION | constant |
Substitution scores of the episode primitives |
|
extract_features | function |
Feature dictionary of one (multivariate) series: every feature of FEATURES for every channel ("x0:mean"...) and, if cross, the correlations of the channel pairs |
|
feature_matrix | function |
Feature matrix of a collection as a pandas DataFrame (one row per series) |
|
FEATURES | constant |
tuple constant |
|
permutation_entropy | function |
Permutation entropy of the ordinal patterns of length order (Bandt and Pompe, 2002) |
|
signature_features | function |
Truncated path signature (levels 1..depth, depth <= 3) of a multivariate series viewed as a piecewise linear path |
|
visibility_graph | function |
Natural visibility graph (divide and conquer, on average) |
|
horizontal_visibility_graph | function |
Horizontal visibility graph: i < j are linked if every sample between them is lower than both |
|
six_sigma_visibility_graph | function |
SPC-zone labelled horizontal visibility graph |
|
spc_zones | function |
Control-chart zone of every sample: "C", "B", "A" within 1, 2, 3 standard deviations, "OUT" beyond the 3 control limits (center and default to the sample mea |
|
western_electric_rules | function |
Boolean flags of the four Western Electric rules: beyond 3; 2 of 3 beyond 2 on one side; 4 of 5 beyond 1 on one side; 8 in a row on one side of the center |
|
ordinal_partition_network | function |
Directed, weighted transition network of the ordinal patterns of length order (nodes are patterns, e.g. "012") |
|
recurrence_network | function |
-recurrence network: nodes are (delay-embedded) states, linked if closer than epsilon (default: the 10 % quantile of the distances) |
|
graph_features | function |
Summary features: mean degree, degree entropy, clustering, assortativity, density; for directed graphs the mean in/out degree asymmetry; for zone-labelled graph |
|
recurrence_plot | function |
Recurrence plot |
|
gramian_angular_field | function |
Gramian angular field of a univariate series rescaled to [-1, 1] (optionally PAA-reduced to n_bins samples) |
|
markov_transition_field | function |
Markov transition field: entry (i, j) is the probability of moving from the quantile state of sample i to that of sample j |
|
dft_coefficients | function |
Magnitudes of the first DFT coefficients of every variable (rows) |
|
haar_dwt | function |
Haar wavelet decomposition (approximation, details per level) of every variable; series are zero-padded to a power of two |
|
chebyshev_coefficients | function |
Chebyshev polynomial coefficients of every variable (Cai and Ng, 2004) |
|
knn_profile | function |
Indices and distances of the k nearest subsequences of every subsequence of width w |
|
matrix_profile | function |
Matrix profile (nearest-neighbour distance) and its index |
|
auto_window | function |
Subsequence width from the first dominant autocorrelation peak of every channel (median over channels), bounded to [lo, hi] (default hi = T/10) |
|
||
|
||
|
||
|
||
|
||
A.4 mvtsa.segmentation: Segmentation
|
Name | Kind |
Description |
|
||
|
Segmentation | class |
A segmentation of one series |
|
BaseSegmenter | class |
Common interface of all segmentation methods |
|
BaseCost | class |
Interface: fit(X) then error(a, b) for the samples X[a:b] |
|
CostL2 | class |
Sum of squared deviations from the segment mean (piecewise constant model) |
|
CostL1 | class |
Sum of absolute deviations from the segment median (robust to outliers) |
|
CostNormal | class |
Gaussian negative log-likelihood with segment-wise mean and full covariance, (up to constants) |
|
CostLinear | class |
Residual sum of squares of a straight line fitted to every variable against time (piecewise linear approximation, PLA; Keogh and Pazzani, 1998) |
|
CostAR | class |
Residual sum of squares of autoregressive models of the given order fitted to every variable inside the segment (detects changes of the dynamics of univariate s |
|
CostPCA | class |
Principal component analysis based homogeneity cost |
|
CostKernel | class |
Kernel cost (Harchaoui and Cappé, 2007; Arlot, Celisse and Harchaoui, 2019): dispersion of the segment in the feature space of a kernel, @@M@@\{}sum_{i\{}in S}k_{ii |
|
CostRegression | class |
Model-based cost: residual sum of squares of a linear regression of the targets on the inputs inside the segment |
|
COSTS | constant |
Registry of segment costs by name |
|
get_cost | function |
Return a cost object from a name (see COSTS) or pass an instance through |
|
BottomUp | class |
Bottom-up segmentation by greedy merging of adjacent segments |
|
TopDown | class |
Binary segmentation: repeatedly split the segment whose best split reduces the total cost most |
|
SlidingWindow | class |
Grow each segment from its start until its cost exceeds max_error (Keogh et al., 2001); suitable for streaming data |
|
SWAB | class |
Sliding Window And Bottom-up (Keogh et al., 2001): bottom-up segmentation inside a moving buffer, emitting the leftmost segment |
|
OptimalPartition | class |
Exact minimization of the total cost for a fixed number of segments by dynamic programming over a grid of candidate change points |
|
PELT | class |
Pruned Exact Linear Time search (Killick et al., 2012): minimizes exactly, pruning candidates that can never be optimal |
|
WindowDiscrepancy | class |
Sliding two-window discrepancy and peak picking (Truong, Oudre and Vayatis, 2020) |
|
MergeTree | class |
Hierarchy of segmentations produced by bottom-up merging |
|
bic_penalty | function |
BIC-type penalty for PELT: n_params log(T) sigma2 |
|
PCASegmenter | class |
Segmentation by the homogeneity of local PCA models |
|
DPCASegmenter | class |
Process-dynamics-aware segmentation with dynamic PCA |
|
KrzanowskiSegmenter | class |
Off-line bottom-up segmentation by the similarity of neighbouring (dynamic) PCA models |
|
RecursivePCASegmenter | class |
On-line segmentation with recursive (dynamic) PCA |
|
pca_segment_models | function |
Fit a (dynamic) PCA model to every segment of a segmentation |
|
GGSegmenter | class |
Fuzzy segmentation with time-constrained PPCA clusters |
|
monotone_labels | function |
Contiguous crisp segmentation that agrees best with fuzzy memberships |
|
FisherSegmenter | class |
Segmentation of historical data by the information they carry on the parameters of a process model |
|
fisher_information | function |
Fisher information matrix of the samples [a, b) from the sensitivities S (T, p) or (T, n_outputs, p); Q is the inverse measurement-error covariance of the outpu |
|
oed_criteria | function |
OED criteria of a Fisher information matrix |
|
criterion_series | function |
Moving-window OED criterion: the "evaluating time series" of Dobos, Bankó and Abonyi (2010) |
|
finite_difference_sensitivities | function |
Output sensitivities by forward finite differences |
|
arx_sensitivities | function |
Sensitivities of the one-step-ahead prediction of an ARX model, , with respect to its parameters: th |
|
BOCPD | class |
Bayesian on-line change point detection |
|
GaussianHMMSegmenter | class |
State detection with a Gaussian HMM |
|
ClaSPSegmenter | class |
Recursive segmentation by classification score profiles |
|
FLUSSSegmenter | class |
Regime extraction with the corrected arc curve (FLUSS) |
|
clasp_profile | function |
Classification score profile of one series (or of X restricted to a range): entry i scores the split before subsequence i |
|
arc_curve | function |
Corrected arc curve (CAC) of FLUSS from a matrix profile index |
|
StateSegmenter | class |
Segment-then-cluster state detection |
|
SparseGaussianStateSegmenter | class |
TICC-style state detection with sparse Gaussian window models |
|
segment_descriptors | function |
Local model of every segment |
|
segment_distance_matrix | function |
Pairwise distances of segment descriptors |
|
NeighborMergeSegmenter | class |
Bottom-up merging of adjacent segments by a pairwise dissimilarity |
|
GraphBottomUp | class |
Bottom-up merging of connected regions of a graph |
|
ClassifierHomogeneity | class |
Dissimilarity of two segments by a classifier two-sample test |
|
RegressionHomogeneity | class |
Dissimilarity of two segments by cross-prediction |
|
PredictiveSegmenter | class |
Bottom-up segmentation by predictive homogeneity |
|
ConsensusSegmenter | class |
Ensemble segmentation by boundary agreement |
|
boundary_agreement | function |
Boundary agreement profile of a list of segmentations (or change point arrays) of the same series |
|
cost_curve | function |
Total cost of the bottom-up segmentation for 1..max_segments segments (one merge run) |
|
relative_reduction | function |
Relative reduction rate of a cost curve |
|
knee_point | function |
Knee of a convex decreasing (or concave increasing) curve: the point farthest from the chord between the end points of the normalized curve |
|
permutation_test_segments | function |
Permutation test for the number of segments |
|
select_n_segments | function |
Choose the number of segments of a cost-based segmentation |
|
penalty_path | function |
Number of change points found by PELT for a range of penalties |
|
StreamSegmenter | class |
Windowed application of a batch segmenter to a stream |
|
CUSUMDetector | class |
Multivariate CUSUM change detector |
|
segment | function |
One-line segmentation: segment(X, "pca", n_segments=4) |
|
SEGMENTERS | constant |
Registry of segmenter names used by segment |
|
||
|
||
|
||
|
||
|
||
A.5 mvtsa.warping: Warping and elastic similarity
|
Name | Kind |
Description |
|
||
|
dtw | function |
DTW distance of two (multivariate) series |
|
dtw_path | function |
Full DTW result: distance, optimal warping path (L, 2), local and accumulated cost matrices |
|
DTWResult | class |
Distance, warping path and accumulated cost matrix of one alignment |
|
dtw_independent | function |
Independent multivariate DTW: the sum of the DTW distances of the variables, each warped separately (DTW_I) |
|
ddtw | function |
Derivative DTW: DTW of the Keogh–Pazzani derivative estimates |
|
wdtw | function |
Weighted DTW: the local cost of cell (i, j) is multiplied by , where is half of the length; large phase |
|
adtw | function |
Amerced DTW: every non-diagonal (warping) step costs an additional penalty (Herrmann and Webb, 2023) |
|
shape_dtw | function |
shapeDTW: DTW on local shape descriptors of every sample; the optimal path is used to accumulate the raw sample distances (Zhao and Itti, 2018) |
|
fast_dtw | function |
FastDTW (Salvador and Chan, 2007): project the path found at a coarser resolution, expand it by radius cells and refine |
|
lb_kim | function |
LB_Kim lower bound of DTW (squared Euclidean local cost): first and last samples |
|
lb_keogh | function |
LB_Keogh lower bound of band-constrained DTW (squared Euclidean cost, equal lengths): the distance of the candidate from the envelope of the query |
|
subsequence_dtw | function |
Best warped match of query inside a longer series |
|
local_cost_matrix | function |
Local cost matrix C[i, j] = d(x_i, y_j) |
|
window_mask | function |
Admissible cells of the warping path |
|
STEP_PATTERNS | constant |
Names of the DTW step patterns |
|
lcss | function |
LCSS distance |
|
edr | function |
Edit distance on real sequences; with normalize divided by the longer length |
|
erp | function |
Edit distance with real penalty; gaps cost the distance to the reference value g (scalar or vector) |
|
twed | function |
Time warp edit distance with stiffness nu and edit penalty lam; tx, ty are time stamps (default: sample indices) |
|
msm | function |
Move–split–merge distance with split/merge cost c; multivariate series are compared channel by channel (sum, the independent strategy of Shifaz et al., 2023) |
|
soft_dtw | function |
Soft-DTW value ; tends to DTW as |
|
soft_dtw_alignment | function |
Soft-DTW value and the expected alignment matrix : a fuzzy warping path whose entries are the probabilities that tw |
|
soft_dtw_divergence | function |
Soft-DTW divergence , zero iff (Blondel et al |
|
gak | function |
Global alignment kernel with a Gaussian local kernel |
|
ncc | function |
Coefficient-normalized cross-correlation sequence of two series (summed over the channels), computed with the FFT; length T_x+T_y-1 |
|
sbd | function |
Shape-based distance of k-Shape (in [0, 2]); with return_shift also the optimal shift of y |
|
CBDTW | class |
Correlation-based dynamic time warping (Bankó and Abonyi, 2012) |
|
PLADistance | class |
Dissimilarities of piecewise linear approximations: MPLA, SPLA and the mixed MDPLA measure (Bankó and Abonyi, 2015) |
|
MixedSegmentDistance | class |
Weighted multivariate segment dissimilarity (a generalization of MDPLA) |
|
SegmentModel | class |
Descriptor of one segment: location, level, trend and correlation structure |
|
segment_models | function |
Descriptors of the segments of X |
|
segment_local_cost | function |
Local cost matrix between two sequences of segment models |
|
segment_dtw | function |
DTW over two sequences of segment models |
|
segpca_distance | function |
SEGPCA baseline: equal numbers of PCA-homogeneous segments compared index by index with (no warping) |
|
LOCAL_DISTANCES | constant |
Names of the local dissimilarities of segment models |
|
align | function |
Pairwise alignment of two symbol sequences |
|
align_episodes | function |
Alignment of two episode sequences (Balaskó, Bankó and Abonyi, 2007) |
|
episode_distance | function |
Dissimilarity of two episode sequences |
|
episode_dtw | function |
DTW over episode sequences (an mvtsa extension) |
|
dba | function |
DTW barycenter averaging of a (multivariate) collection |
|
soft_dtw_barycenter | function |
Soft-DTW barycenter by L-BFGS on the average’s samples |
|
medoid | function |
Medoid of a collection under any distance function |
|
path_statistics | function |
Statistics of one warping path (L, 2) |
|
tightness_of_warping | function |
Tightness of warping (ToW) of a data set under one local dissimilarity |
|
warping_function | function |
Warping function : the mean index of the second series aligned to sample i of the first |
|
loo_1nn_accuracy | function |
Leave-one-out 1-NN accuracy from a distance matrix |
|
learn_window | function |
Band width maximizing the LOO 1-NN accuracy (ties: the narrowest) |
|
learn_segment_weights | function |
Grid search of the weights of a segment-level measure |
|
ElasticEnsemble | class |
1-NN ensemble of elastic distances (after Lines and Bagnall, 2015) |
|
||
|
||
|
||
|
||
|
||
A.6 mvtsa.distances: Distances
|
Name | Kind |
Description |
|
||
|
euclidean | function |
|
|
manhattan | function |
|
|
chebyshev | function |
|
|
correlation_distance | function |
of the flattened (multivariate) series |
|
cosine_distance | function |
|
|
pca_distance | function |
with a PCA similarity factor of the two whole series (no time alignment; series may have different lengths) |
|
DISTANCES | constant |
Registry of distance functions by name |
|
get_distance | function |
Distance function from a name (see DISTANCES) or a callable |
|
pairwise_distances | function |
Distance matrix of a collection (or between two collections) |
|
is_elastic | function |
Whether a named metric accepts series of different lengths |
|
||
|
||
|
||
|
||
|
||
A.7 mvtsa.clustering: Clustering
|
Name | Kind |
Description |
|
||
|
TimeSeriesKMeans | class |
k-means for time series |
|
KShape | class |
k-Shape clustering (Paparrizos and Gravano, 2015) |
|
KMedoids | class |
k-medoids by PAM (BUILD + SWAP) on a distance matrix |
|
FuzzyCMedoids | class |
Relational fuzzy c-medoids (Krishnapuram, Joshi, Nasraoui and Yi, 2001) |
|
HierarchicalClustering | class |
Agglomerative clustering on a distance matrix |
|
SpectralClustering | class |
Spectral clustering of time series |
|
DensityClustering | class |
DBSCAN or HDBSCAN on a time series distance matrix (label -1 = noise) |
|
ConsensusClustering | class |
Evidence-accumulation consensus of several clusterings |
|
coassociation_matrix | function |
Fraction of partitions in which two objects share a cluster (noise labels -1 never co-occur) |
|
FeatureClustering | class |
Cluster series by feature vectors |
|
SegmentClustering | class |
Cluster the segments of a collection into recurring regimes |
|
TrajectoryClustering | class |
Clustering of objects moving in a common phase space |
|
neighborhood_preservation | function |
Mean Jaccard similarity of the k-nearest-neighbour sets of every pair of objects along time |
|
||
|
||
|
||
|
||
|
||
A.8 mvtsa.evaluation: Evaluation and validation
|
Name | Kind |
Description |
|
||
|
change_point_scores | function |
Precision, recall and F1 of change points with a tolerance margin |
|
f1_score_cp | function |
F1 of change points (see change_point_scores) |
|
covering | function |
Covering of the true segmentation by the predicted one: with the Jaccard index @@M@@ |
|
hausdorff | function |
Hausdorff distance of the two change point sets (inf if exactly one is empty) |
|
annotation_error | function |
Absolute difference of the numbers of change points |
|
mean_boundary_error | function |
Mean distance of every true change point to the nearest predicted one |
|
state_scores | function |
Adjusted Rand index, adjusted mutual information and normalized mutual information of per-sample state (or segment) labels |
|
evaluate_segmentation | function |
All segmentation scores at once |
|
purity | function |
Fraction of objects in the majority class of their cluster |
|
matched_accuracy | function |
Accuracy after the optimal one-to-one matching of clusters and classes (Hungarian algorithm) |
|
clustering_scores | function |
ARI, AMI, NMI, purity and matched accuracy |
|
silhouette | function |
Mean silhouette width from a distance matrix (noise label -1 ignored) |
|
dunn_index | function |
Smallest between-cluster distance divided by the largest cluster diameter |
|
partition_coefficient | function |
Bezdek’s partition coefficient of a membership matrix (N, c) |
|
partition_entropy | function |
Bezdek’s partition entropy of a membership matrix (N, c) |
|
knn_accuracy | function |
Leave-one-out k-NN classification accuracy from a distance matrix (1 - the 1-NN error rate of the UCR experiments) |
|
precision_recall_curve_knn | function |
Precision at recall levels r = 1..r_items (Bankó, 2015, Alg |
|
mean_average_precision | function |
Mean average precision of leave-one-out retrieval |
|
segmentation_stability | function |
Stability of a segmentation under perturbations |
|
clustering_stability | function |
Mean pairwise ARI of clusterings of random subsamples, compared on the objects they share |
|
sensitivity | function |
Run factory(**{param: v}) for every value and record the number of segments, the change points and an optional score(segmentation) |
|
friedman_nemenyi | function |
Friedman test and Nemenyi critical difference |
|
wilcoxon_holm | function |
Pairwise Wilcoxon signed-rank tests with Holm’s correction; returns a pandas DataFrame (method_a, method_b, p_value, p_holm, significant) |
|
Benchmark | class |
Systematic comparison of methods on data sets |
|
grid_search_segmenter | function |
Grid search of segmenter parameters |
|
||
|
||
|
||
|
||
|
||
A.9 mvtsa.simplify: Simplification
|
Name | Kind |
Description |
|
||
|
smooth_states | function |
Absorb runs shorter than min_duration samples into a neighbouring run (the longer neighbour), repeatedly, until all runs are long enough |
|
merge_short_segments | function |
Remove change points so that every segment has at least min_length samples |
|
prune_change_points | function |
Remove change points whose removal increases the total cost by less than min_gain (default: relative times the cost of the unsegmented series), weakest first |
|
reduce_segments | function |
Coarsest level of a bottom-up merge hierarchy whose explained cost reduction is at least keep of the finest level’s: @@M@@(cost_1-cost_c)/(cost_1-cos |
|
simplify_pla | function |
Piecewise linear approximation with the fewest segments whose mean squared error per sample stays below max_error |
|
compression_report | function |
Compression ratio and reconstruction error of a piecewise constant ("mean") or linear ("linear") representation |
|
reduce_components | function |
Return a copy of a fitted PCAModel keeping the fewest components that explain explained of the variance |
|
select_prototypes | function |
Indices of representative series: the n_per_class medoids of every class (or of the whole set) under the distance matrix D, selected greedily (k-medoids BUILD s |
|
||
|
||
|
||
|
||
|
||
A.10 mvtsa.explain: Explanation
|
Name | Kind |
Description |
|
||
|
boundary_contributions | function |
Contribution of the variables to every change |
|
describe_segments | function |
Per-segment table: start, stop, length, state, means, standard deviations, slopes and the variance explained by the first principal components of the segment |
|
explain_states | function |
Decision-tree explanation of state labels |
|
transition_graph | function |
Regime transition network of a state-labelled segmentation |
|
||
|
||
|
||
|
||
|
||
A.11 mvtsa.mlops: Model operations
|
Name | Kind |
Description |
|
||
|
to_config | function |
Dictionary {"class": "module.Class", "params": {...}} of an estimator |
|
from_config | function |
Rebuild an estimator from to_config output |
|
save_config | function |
Write a configuration (or the configuration of an object) to JSON or YAML |
|
load_config | function |
Read a JSON or YAML configuration file |
|
AnalysisPipeline | class |
Preprocess -> segment -> learn regimes -> label new data |
|
save_model | function |
Save a model directory (model.joblib, config.json, metadata.json) |
|
load_model | function |
Load a model saved by save_model; with verify the file hash is checked and a warning is raised if the package version differs |
|
ModelRegistry | class |
File-based model registry |
|
ExperimentTracker | class |
Experiment tracking with a local backend and optional MLflow mirroring |
|
data_fingerprint | function |
SHA-256 fingerprint of an array or collection (shape and values) |
|
DataContract | class |
Expected properties of input data |
|
DriftMonitor | class |
Batch-wise drift monitoring against reference data |
|
population_stability_index | function |
Population stability index of a univariate feature (bins: reference quantiles) |
|
model_card | function |
Markdown model card of an mvtsa model (written to path if given) |
|
||
|
||
|
||
|
||
|
||
A.12 mvtsa.io: Import and export
|
Name | Kind |
Description |
|
||
|
from_dataframe | function |
Series (T, n) and variable names from a wide pandas DataFrame (sorted by time_column if given) |
|
to_dataframe | function |
Wide DataFrame of a series, optionally with segment and state columns |
|
collection_from_long | function |
Collection from a long table (one row per sample, id_column per series); returns (collection, labels or None, ids) |
|
to_numpy3d | function |
3-D array of a collection |
|
from_numpy3d | function |
Collection from a 3-D array; trailing all-NaN samples are removed |
|
save_segmentation | function |
Write a segmentation to JSON |
|
load_segmentation | function |
|
|
from_ruptures | function |
Segmentation from ruptures breakpoints (last element = T) |
|
to_ruptures | function |
|
|
ruptures_segment | function |
Run a ruptures detector (pip install ruptures) and return an mvtsa Segmentation |
|
to_spmviz | function |
Symbol or episode sequences as an spmviz.SequenceDatabase (pip install spmviz); episodes are replaced by their primitive codes |
|
matrix_profile_stumpy | function |
Matrix profile of a univariate series with STUMPY (pip install stumpy): (profile, index) |
|
||
|
||
|
||
|
||
|
||
A.13 mvtsa.viz: Visualization
|
Name | Kind |
Description |
|
||
|
plot_series | function |
Small multiples: one panel per variable |
|
plot_segmentation | function |
Series with the segments shaded (state colours if the segmentation has state labels), change points as vertical lines, optional true change points (dashed, at t |
|
plot_fuzzy_segmentation | function |
Two panels: the series with the crisp segments, and the fuzzy memberships of the segments along time |
|
plot_states | function |
State timeline: one coloured bar per segment |
|
plot_profile | function |
A change profile (ClaSP score, FLUSS arc curve, BOCPD change probability, boundary agreement, similarity) with the detected change points |
|
plot_run_length | function |
Run-length posterior of BOCPD (log scale) with the MAP run length |
|
plot_cost_curve | function |
Total cost against the number of segments, with the relative reduction rate as bars on a second axis (Bankó, 2015, Figures 3.3 and 3.6) |
|
plot_segmentogram | function |
Segmentogram: every level of a bottom-up merge hierarchy as one row (top: one segment, bottom: max_segments), segments drawn as alternating bands, change points |
|
plot_boundary_agreement | function |
Consensus segmentation: the change points of every member (one row each) above the boundary agreement profile |
|
plot_pca_statistics | function |
Hotelling and of a PCA model along the series with their control limits |
|
plot_segment_loadings | function |
Heatmap of the loadings of one principal component of every segment (rows: variables, columns: segments): how the correlation structure changes from segment to |
|
plot_contributions | function |
Stacked bars of the variable contributions to every change point (output of boundary_contributions) |
|
plot_transition_graph | function |
Regime transition network (transition_graph): node size = total duration, edge width = transition probability |
|
plot_alignment | function |
The two series (y shifted down by offset) with grey lines joining the aligned samples (Bankó, 2015, Figure 2.6) |
|
plot_cost_matrix | function |
Local (or accumulated) cost matrix with the optimal warping path and the two series along the axes |
|
plot_alignment_uncertainty | function |
Expected alignment matrix of soft-DTW (probability that two samples are aligned) with the hard DTW path on top |
|
plot_warping_function | function |
Warping functions of one or several paths, normalized to [0, 1], against the diagonal |
|
plot_segment_alignment | function |
Segment-level alignment of correlation-based DTW: both series with their segments as coloured bands and the aligned segments connected at their centres |
|
plot_average | function |
Members of a cluster (grey) and their (DBA or soft-DTW) average |
|
sammon | function |
Sammon mapping (Sammon, 1969) of a distance matrix by Newton-type iterations; returns (Y, stress) |
|
fuzzy_sammon | function |
Fuzzy Sammon mapping (Feil, Balaskó and Abonyi, 2007) for relational fuzzy clusterings: the data are mapped so that their distances to the cluster prototypes (m |
|
plot_dendrogram | function |
Dendrogram of a hierarchical clustering |
|
plot_cluster_prototypes | function |
One panel per cluster: members (thin, grey), their mean +- standard deviation band (resampled to a common length) and the centre if given (centers is a dict lab |
|
plot_distance_matrix | function |
Distance matrix heatmap, ordered by labels ("label"), by the leaves of an average-linkage dendrogram ("cluster") or as given |
|
plot_embedding | function |
2-D map of a distance matrix by Sammon mapping, metric MDS or t-SNE, coloured by labels |
|
plot_pla | function |
Series and its piecewise linear approximation; each segment is annotated with its slope angle |
|
plot_sax | function |
z-normalized series, its PAA and the SAX symbols with the Gaussian breakpoints |
|
plot_episodes | function |
Series with its qualitative episodes: coloured bands labelled by the primitive codes and, above them, the triangular glyphs of the representation of Cheung and |
|
plot_recurrence | function |
Recurrence plot (thresholded or distance matrix) |
|
plot_visibility_graph | function |
Series as bars with its visibility arcs drawn above; if the graph is zone labelled (six_sigma_visibility_graph) nodes are coloured by their SPC zone and the con |
|
plot_critical_difference | function |
Critical difference diagram (Demšar, 2006): methods on the average rank axis, with bars joining methods whose ranks differ by less than the critical difference |
|
plot_precision_recall | function |
Precision against recall levels for several measures (Bankó, 2015, Figures 3.4–3.9); curves maps names to the output of precision_recall_curve_knn |
|
plot_metric_heatmap | function |
Heatmap of a data set x method table (e.g. Benchmark.pivot) with the values printed |
|
plot_stability | function |
Boundary frequency under perturbations (segmentation_stability) with the reference change points and their support |
|
segmentation_dashboard | function |
One-page summary of a segmentation: the segmented series, the state timeline, the cost curve (if a merge tree is given) and the variable contributions to the ch |
|
BRAND | constant |
str constant |
|
OKABE_ITO | constant |
list constant |
|
CATEGORICAL | constant |
list constant |
|
||
|
||
|
||
|
||
|
||
A.14 mvtsa.datasets: Data sets
|
Name | Kind |
Description |
|
||
|
make_piecewise_stationary | function |
Piecewise stationary Gaussian series |
|
make_correlation_switching | function |
Segments with equal means and variances but different correlation structure: in every state the variables are driven by n_latent hidden factors through a differ |
|
make_dynamic_switching | function |
Linear time-variant SISO systems of Bankó (2015, Ch |
|
make_regime_process | function |
Recurring operating regimes of a process: every regime has its own operating point and latent correlation structure; the regimes recur in random order with smoo |
|
make_energy_process | function |
Energy monitoring data in the spirit of Abonyi et al. (2013): the specific energy consumption (column 0, the key energy indicator) depends linearly on the load |
|
simulate_ph_cstr | function |
pH neutralization of a strong acid by a strong base in a continuous stirred tank (the pH case study of Bankó, 2015, Ch |
|
simulate_mma_cstr | function |
Isothermal MMA polymerization CSTR (four states, one input) |
|
MMA_PARAMETERS | constant |
Kinetic and operating parameters of the MMA polymerization reactor |
|
make_cbf | function |
Cylinder–Bell–Funnel data (Saito, 1994): three classes of univariate patterns with random onset, duration and amplitude |
|
make_synthetic_control | function |
Synthetic control chart patterns (Alcock and Manolopoulos, 1999): normal, cyclic, increasing trend, decreasing trend, upward shift, downward shift |
|
make_signatures | function |
Synthetic on-line signatures: pen trajectories with five channels [x, y, pressure, azimuth, altitude] |
|
make_motion_collection | function |
Multivariate motion-like series (accelerometer + gyroscope): every class is an activity with its own frequency content and inter-channel phase pattern, with ran |
|
make_correlation_sequences | function |
Collection whose classes differ only in the sequence of correlation structures |
|
make_dynamic_sequences | function |
Collection of input–output series [u, y] of a first-order system whose time constant follows a class-specific sequence of three values (fast, medium, slow) |
|
random_time_warp | function |
Apply a smooth, monotone random time warping to a series (and resample it to length) |
|
load_basic_motions | function |
BasicMotions: 6-channel activity recordings (see module doc) |
|
load_japanese_vowels | function |
JapaneseVowels: 12-channel, variable-length speech data |
|
load_gunpoint | function |
GunPoint: univariate hand trajectories |
|
load_bundled | function |
Load a bundled collection: (list_of_series, labels) |
|
data_home | function |
|
|
fetch_ucr_uea | function |
Download (once) and load a UCR/UEA archive data set |
|
fetch_tssb | function |
Download (once) and load TSSB series |
|
read_ts_file | function |
Read a .ts file of the archives: (list_of_series, labels) |
|
||
|
||
|
||
|
||
|
||