fuzzyclust.relational.autocorrelation_distance_matrix#

fuzzyclust.relational.autocorrelation_distance_matrix(X, Y=None, n_lags=10, weights=None)[source]#

Autocorrelation-based distance between time series (D’Urso and Maharaj, 2009).

Two series are considered similar when their dependence structure is similar, whatever their level or phase: the series are represented by their estimated autocorrelation functions up to lag \(L\) and compared by the (optionally weighted) Euclidean distance

\[d_{\mathrm{ACF}}(\mathbf{x}_j,\mathbf{x}_k)= \Big(\sum_{l=1}^{L} w_l\,\big(\hat\rho_j(l)-\hat\rho_k(l)\big)^2\Big)^{1/2}.\]

Because the representation is a feature vector, the squared matrix is Euclidean and relational c-means on it coincides with fuzzy c-means on the autocorrelation features.

Parameters:
Xarray_like of shape (n_series, length)
Yarray_like of shape (n_other, length), optional
n_lagsint, default=10

Number of lags \(L\).

weightsarray_like of shape (n_lags,), optional

Lag weights \(w_l\) (uniform by default; geometrically decaying weights emphasize the first lags).

Returns:
Dndarray of shape (n_series, n_series) or (n_series, n_other)

References

[1]

P. D’Urso, E. A. Maharaj, “Autocorrelation-based fuzzy clustering of time series”, Fuzzy Sets and Systems 160(24), 3565–3589, 2009.

Examples

>>> import numpy as np
>>> from fuzzyclust.relational import autocorrelation_distance_matrix
>>> rng = np.random.RandomState(0)
>>> e = rng.randn(3, 200)
>>> smooth = np.cumsum(e[:2], axis=1)  # strongly autocorrelated
>>> X = np.vstack([smooth, e[2:]])      # plus a white-noise series
>>> D = autocorrelation_distance_matrix(X, n_lags=5)
>>> bool(D[0, 1] < D[0, 2])
True

Examples using fuzzyclust.relational.autocorrelation_distance_matrix#

Autocorrelation-based fuzzy clustering of time series

Autocorrelation-based fuzzy clustering of time series