Preprocessing#

Preprocessing of multivariate time series.

Normalization, resampling, missing values, smoothing and derivatives, lag (Hankel) embedding used by dynamic PCA, delay-coordinate embedding with lag and dimension selection, and a linear Kalman filter / RTS smoother for model-based state estimation before segmentation (Feil et al., 2005).

Scaling, resampling, missing values, smoothing, derivatives, lag matrices, delay embedding and Kalman smoothing.

Classes#

Standardizer([method])

Fit-once, apply-many standardization (for pipelines and deployment).

Functions#

zscore(X[, axis])

Z-normalize every variable (zero mean, unit standard deviation).

minmax(X[, feature_range])

Scale every variable to feature_range.

robust_scale(X)

Center by the median and scale by the interquartile range.

resample(X, length[, kind])

Resample a series to length samples by interpolation over [0, 1].

resample_collection(data[, length, kind])

Resample every series of a collection to a common length.

fill_missing(X[, method])

Fill NaN values column-wise by "linear" interpolation, "ffill" (last observation carried forward) or "mean".

moving_average(X, window)

Centered moving average (edges use the available samples).

smooth(X[, method, window, order, sigma])

Smooth every variable: "savgol" (Savitzky--Golay), "gaussian" or "moving" average.

derivative(X[, order, method, window])

First or second derivative per sample ("gradient" = central differences, "savgol" = Savitzky--Golay derivative filter).

keogh_derivative(X)

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

dynamize(X, lags)

Lag-extended data matrix of dynamic PCA (Ku, Storer and Georgakis, 1995).

delay_embedding(x, dim[, tau])

Delay-coordinate embedding of a univariate series (Takens): rows [x(t), x(t+tau), ..., x(t+(dim-1)tau)].

ami_lag(x[, max_lag, bins])

Embedding delay at the first minimum of the average mutual information (Fraser and Swinney, 1986).

false_nearest_neighbors(x, tau[, max_dim, ...])

Embedding dimension by the false nearest neighbour method of Kennel, Brown and Abarbanel (1992).

kalman_smoother(Y, A, C, Q, R[, x0, P0, B, ...])

Linear Kalman filter and Rauch--Tung--Striebel smoother.

detrend(X[, order])

Remove a polynomial trend of the given order from every variable.