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 22 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)
(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)
(d) Determinism tsdr.determinism DyCA (dynamical component analysis), DMD (dynamic mode decomposition)
(e) Non-stationarity tsdr.nonstationarity ASSA (analytic stationary subspace analysis), SSAsir, SSAsave, SSAcor (stationary subspace analysis via sliced inverse regression, sliced average variance estimation, and time-lagged autocorrelation), WaSSAf, WaSSAr (Wasserstein stationary subspace analysis using the Fréchet and root-Fréchet means), BSSnonstat (blind source separation via non-stationarity of variances)
(f) Diffusion tsdr.diffusion DMcov (diffusion maps using covariance distance), DIG (dynamical information geometry)
(g) Latent variable tsdr.latentvariable LDS (latent linear dynamical system)

The figure at the top summarizes these categories.

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

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.6
File Size Uploaded Provenance
tsdr-0.6.tar.gz 40.0 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 73.6 kB

Release files / tsdr-0.6.tar.gz

Download URL tsdr-0.6.tar.gz
Size 40.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e45cc60adb5b40fe84393dea4b831198299457abbdc99f9821d8a38630098e92
BLAKE2b-256 checksum
How to use checksums
d7485562cd7518e4ec7fdf1c1355ba1819503e0372a4aef8a423f99ea9a34236
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

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

Download URL tsdr-0.6-py3-none-any.whl
Size 33.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ee790daa342dc395bc3ab8b9f819f004ff637fa3dc68750e39771daac16f9a5
BLAKE2b-256 checksum
How to use checksums
00e05547c7867a2486f26b7e87a43793aaa4309eeb351f39025f3f3cc56cf20c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Security for tsdr 0.6

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