Representations#

Representations of multivariate time series: latent-variable models, covariance geometry, piecewise, symbolic, qualitative (episode), feature, signature, network, image and matrix-profile representations.

PCA and probabilistic PCA models, recursive PCA, similarity factors, SPD geometry, piecewise and symbolic approximations, qualitative episodes, features and path signatures, graphs, images and matrix profiles.

Classes#

PCAModel([n_components, center, scale, lags])

Principal component model with monitoring statistics.

PPCAModel([n_components])

Probabilistic PCA (Tipping and Bishop, 1999).

RecursivePCA([forgetting, variable, ...])

Recursive (exponentially weighted) PCA with a variable forgetting factor.

PLA(segmentation, intercepts, slopes, means)

Piecewise linear approximation of a (multivariate) series.

SAX([n_segments, alphabet_size])

SAX transform with n_segments PAA frames and alphabet_size symbols.

Episode(primitive, start, stop, magnitude)

One episode: primitive code, half-open sample range and magnitude (signed change of the signal over the episode).

Functions#

select_dpca_lag(X[, max_lag, method, ratio, ...])

Number of lags of dynamic PCA.

resolve_n_components(eigenvalues, n_components)

Number of retained components.

krzanowski_similarity(U1, U2)

Krzanowski's PCA similarity factor (1979): \(s_{PCA}=\frac1p\operatorname{tr}(U_1^{\mathsf T}U_2U_2^{\mathsf T}U_1) =\frac1p\sum_{i,j}\cos^2\Theta_{ij}\), in [0, 1].

lambda_similarity(U1, lam1, U2, lam2)

Eigenvalue-weighted PCA similarity factor (Johannesmeyer, 1999; Singhal and Seborg, 2002).

eros_similarity(U1, U2[, weights])

Eros, the extended Frobenius norm similarity of Yang and Shahabi (2004): \(\sum_i w_i\lvert\cos\Theta_i\rvert\) over corresponding eigenvectors.

eros_weights(eigenvalue_list)

Eros weights (Yang and Shahabi, 2004): the normalized eigenvalue profiles averaged over a learning set, renormalized to sum to one.

principal_angles(U1, U2)

Principal angles (radians, increasing) between the column spaces of U1 and U2 (orthonormalized internally).

grassmann_distance(U1, U2)

Geodesic (arc-length) distance on the Grassmann manifold: \(\sqrt{\sum_i\theta_i^2}\).

chordal_distance(U1, U2)

Projection (chordal) distance \(\sqrt{\sum_i\sin^2\theta_i}\).

mean_distance_similarity(mu1, mu2, cov)

Distance similarity factor of Singhal and Seborg (2005): the probability that the Mahalanobis distance between the means is exceeded under a standard normal reference, \(2(1-\Phi(\Delta))\).

log_euclidean_distance(A, B[, eps])

\(\lVert\log A-\log B\rVert_F\) (Arsigny et al., 2007).

affine_invariant_distance(A, B[, eps])

\(\sqrt{\sum_i\log^2\lambda_i(A^{-1}B)}\) (Pennec et al., 2006).

bures_wasserstein_distance(A, B[, eps])

\(\bigl(\operatorname{tr}A+\operatorname{tr}B-2\operatorname{tr} (A^{1/2}BA^{1/2})^{1/2}\bigr)^{1/2}\), the 2-Wasserstein distance of two centered Gaussians (Bhatia et al., 2019).

gaussian_w2_distance(mu1, A, mu2, B)

2-Wasserstein distance between \(N(\mu_1,A)\) and \(N(\mu_2,B)\).

gaussian_jeffreys_divergence(mu1, A, mu2, B)

Symmetric Kullback--Leibler (Jeffreys) divergence of two Gaussians.

spd_mean(mats[, metric, weights])

Mean of SPD matrices: "log_euclidean" (closed form) or "euclidean".

paa(X, n_segments)

PAA of every variable: (n_segments, n) frame means (frames of nearly equal length when T is not divisible).

inverse_paa(P, length)

Step-function reconstruction of a PAA representation.

apca(X, n_segments)

APCA: bottom-up segmentation with the L2 cost (segment means are Segmentation.to_frame(X)).

pla(X[, n_segments, max_error, method])

Piecewise linear approximation.

pip(x, k[, distance])

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 neighbouring PIPs ("vertical" or "euclidean" distance).

sax(x[, n_segments, alphabet_size])

Shorthand for SAX(n_segments, alphabet_size).transform(x).

abba(x[, tol, n_symbols, scale, random_state])

ABBA symbolic representation of a univariate series.

sfa(x[, n_coefficients, alphabet_size, ...])

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 given breakpoints or Gaussian quantiles scaled by the coefficient magnitude).

triangular_episodes(x[, sigma, eps1, eps2, ...])

Episode sequence of a univariate signal.

episode_string(episodes)

The primitive codes of an episode sequence as a string.

size_classes(episodes[, ...])

Size class ("small", "medium", "large") of every episode from its duration and absolute magnitude.

multivariate_episodes(X[, method])

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

extract_features(X[, names, cross])

Feature dictionary of one (multivariate) series: every feature of FEATURES for every channel ("x0:mean"...) and, if cross, the correlations of the channel pairs ("corr:0-1"...).

feature_matrix(collection[, standardize])

Feature matrix of a collection as a pandas DataFrame (one row per series).

permutation_entropy(x[, order, delay, normalize])

Permutation entropy of the ordinal patterns of length order (Bandt and Pompe, 2002).

signature_features(X[, depth, add_time, ...])

Truncated path signature (levels 1..``depth``, depth <= 3) of a multivariate series viewed as a piecewise linear path.

visibility_graph(x)

Natural visibility graph (divide and conquer, \(O(T\log T)\) on average).

horizontal_visibility_graph(x[, directed])

Horizontal visibility graph: i < j are linked if every sample between them is lower than both.

six_sigma_visibility_graph(x[, center, ...])

SPC-zone labelled horizontal visibility graph.

spc_zones(x[, center, sigma])

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 mean and standard deviation).

western_electric_rules(x[, center, sigma])

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(x[, order, delay])

Directed, weighted transition network of the ordinal patterns of length order (nodes are patterns, e.g. "012").

recurrence_network(X[, epsilon, dim, tau])

ε-recurrence network: nodes are (delay-embedded) states, linked if closer than epsilon (default: the 10 % quantile of the distances).

graph_features(G)

Summary features: mean degree, degree entropy, clustering, assortativity, density; for directed graphs the mean in/out degree asymmetry; for zone-labelled graphs the fraction of edges per zone pair.

recurrence_plot(X[, epsilon, dim, tau, ...])

Recurrence plot.

gramian_angular_field(x[, kind, n_bins])

Gramian angular field of a univariate series rescaled to [-1, 1] (optionally PAA-reduced to n_bins samples).

markov_transition_field(x[, n_states, n_bins])

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(X[, n_coefficients])

Magnitudes of the first DFT coefficients of every variable (rows).

haar_dwt(X[, level])

Haar wavelet decomposition (approximation, details per level) of every variable; series are zero-padded to a power of two.

chebyshev_coefficients(X[, degree])

Chebyshev polynomial coefficients of every variable (Cai and Ng, 2004).

knn_profile(X, w[, k, exclusion, normalize])

Indices and distances of the k nearest subsequences of every subsequence of width w.

matrix_profile(X, w[, exclusion, normalize])

Matrix profile (nearest-neighbour distance) and its index.

auto_window(X[, lo, hi])

Subsequence width from the first dominant autocorrelation peak of every channel (median over channels), bounded to [lo, hi] (default hi = T/10).

Constants#

PRIMITIVES

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

DIRECTION

QTA_SUBSTITUTION

ndarray(shape, dtype=None, buffer=None, offset=0, strides=None, order=None)

FEATURES

Built-in immutable sequence.