Skip to main content

tsdr: Time-Series Dimension Reduction

The seven categories of time-series dimension reduction methods

Paper PyPI version License: MIT

tsdr is a Python package of time-series dimension reduction (TSDR) methods: algorithms that reduce multivariate data to a few components by exploiting temporal structure. In contrast to general dimension reduction (GDR) methods, whose outputs are invariant to temporal permutation, TSDR methods are sensitive to temporal structure. The package implements 30 methods from the seven categories of TSDR methods defined in Owens & Fulcher (2025), written in a simple, readable style to help time-series analysts understand the algorithms discussed in that review.

Installation

pip install tsdr

The package is on PyPI and requires Python 3.8 or later. It depends on numpy, scipy, scikit-learn, pywavelets and kneed. The example below also uses matplotlib.

Quick start

Every method is a class with a scikit-learn-style fit, transform and fit_transform. Here we extract a slow sinusoid from a linear mixture of noise channels using slow feature analysis (SFA):

from tsdr.slowness import SFA

import numpy as np
import scipy
import matplotlib.pyplot as plt

# create a dataset for analysis
# a sinusoid
z = np.sin(np.linspace(0, 4*np.pi, 1000))
# multichannel noise
D = 5
noise = np.random.normal(scale=1.0, size=((len(z), D-1)))
# linear mixing
A = scipy.stats.ortho_group.rvs(D, random_state=1)
X = np.concatenate([z.reshape(-1,1), noise], axis=1) @ A

# extract a slow component using SFA
slow_component = SFA(n_components=1).fit_transform(X)

# visualize the component
fig, axs = plt.subplots(6, 1, figsize=(8, 8))
axs[0].plot(slow_component, lw=1.0)
axs[0].set_ylabel('SFA1')
for i in range(D):
    axs[i].spines[['right', 'top', 'bottom']].set_visible(False)
    axs[i].set_xticks([])
    axs[i+1].plot(X[:, i], c='black', linewidth=0.5)
    axs[i+1].set_ylabel(f'X{i+1}')
axs[D].spines[['right', 'top']].set_visible(False)
axs[D].set_xlabel('Time')
plt.tight_layout()

SFA recovers the slow sinusoid from five mixed channels

Available methods

The methods are grouped by the aspect of temporal structure that they exploit. Each is imported from the module named in the first column, e.g., from tsdr.slowness import SFA.

Category Module Methods
(a) Slowness tsdr.slowness SFA (slow feature analysis)
BioSFA (biologically plausible SFA)
ISFA (independent slow feature analysis)
SICA (slow independent component analysis)
(b) Autocorrelation tsdr.autocorrelation TICA (time-lagged independent component analysis)
TMCA (time-lagged maximum covariance analysis)
CSA (colored subspace analysis)
TCCA_Stiefel (time-lagged canonical component analysis by trace optimization on the Stiefel manifold)
sPCA_dwt (spectral PCA using the discrete wavelet transform)
(c) Predictability tsdr.predictability TLPC (temporally local predictive coding)
PrCA (predictable component analysis)
DiCCA (dynamic inner canonical correlation analysis)
ForeCA (forecastable component analysis)
PFA (predictable feature analysis)
PTS (principal time series)
DCA (dynamical components analysis)
(d) Determinism tsdr.determinism DyCA (dynamical component analysis)
DMD (dynamic mode decomposition)
(e) Non-stationarity tsdr.nonstationarity ASSA (analytic stationary subspace analysis)
SSAsir (stationary subspace analysis via sliced inverse regression)
SSAsave (stationary subspace analysis via sliced average variance estimation)
SSAcor (stationary subspace analysis via time-lagged autocorrelation)
WaSSAf (Wasserstein stationary subspace analysis using the Fréchet mean)
WaSSAr (Wasserstein stationary subspace analysis using the root-Fréchet mean)
BSSnonstat (blind source separation via non-stationarity of variances)
(f) Diffusion tsdr.diffusion DMcov (diffusion maps using covariance distance)
DIG (dynamical information geometry)
NLSA (nonlinear Laplacian spectral analysis)
(g) Latent variable tsdr.latentvariable LDS (latent linear dynamical system)
DFA (dynamic factor analysis)

The figure at the top summarizes these categories.

A few methods differ from the common pattern:

  • Methods with a random initialization or random order of updates (BioSFA, ISFA, SICA, ForeCA, DCA, BSSnonstat, and LDS and DFA with init='random') accept a random_state argument for reproducible results; TCCA_Stiefel uses a seed argument. LDS and DFA are initialised deterministically by default (init='autocorrelation').
  • The diffusion methods are nonlinear, so they have fit_transform but no separate transform. DMcov and DIG embed sliding windows of the time series (of length window, every step samples), so they return one row per window; NLSA embeds the time series with q lags, so it returns n_samples - q rows (for time points q onwards).

Citation

If you use this software, please read and cite the open-access article:

Owens, K. S. & Fulcher, B. D. (2025). Time-series dimension reduction: a comprehensive review and conceptual unification of algorithms. TechRxiv. doi:10.36227/techrxiv.176409662.29359239/v1

@article{owens2025tsdr,
  title   = {Time-series dimension reduction: a comprehensive review and conceptual unification of algorithms},
  author  = {Owens, Kieran S. and Fulcher, Ben D.},
  journal = {TechRxiv},
  year    = {2025},
  doi     = {10.36227/techrxiv.176409662.29359239/v1}
}

License

tsdr is released under the MIT License.

Metadata

Release files for tsdr 0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tsdr 0.9
File Size Uploaded Provenance
tsdr-0.9.tar.gz 60.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tsdr 0.9
File Interpreter ABI Platform
tsdr-0.9-py3-none-any.whl Python 3 none any Details

Total release size: 107.6 kB

Release files / tsdr-0.9.tar.gz

Download URL tsdr-0.9.tar.gz
Size 60.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f05d65e57ee1fff55ff893f1a988a8dcca80ade7fabbd03c0401a38e4b6dc7fd
BLAKE2b-256 checksum
How to use checksums
8fab7b15bdb1fee15154b0d9b8862df2551a1aac4e64f450473f20f7ae0fa970
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / tsdr-0.9-py3-none-any.whl

Download URL tsdr-0.9-py3-none-any.whl
Size 47.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02d7df1cc15c33b767d574f47ca16cf6d46979562ab9cf99d1b8f5879f139764
BLAKE2b-256 checksum
How to use checksums
97170fafd5387deb74845795c6ee4e6a3678b126dba3209f856c5af0a119eae1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Security for tsdr 0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page