tsdr: Time-Series Dimension Reduction
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()
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,LDS,DFA) accept arandom_stateargument for reproducible results;TCCA_Stiefeluses aseedargument. - The diffusion methods are nonlinear, so they have
fit_transformbut no separatetransform.DMcovandDIGembed sliding windows of the time series (of lengthwindow, everystepsamples), so they return one row per window;NLSAembeds the time series withqlags, so it returnsn_samples - qrows (for time pointsqonwards).
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.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| tsdr-0.8.tar.gz | 59.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tsdr-0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 105.7 kB
Release files / tsdr-0.8.tar.gz
| Download URL | tsdr-0.8.tar.gz |
|---|---|
| Size | 59.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2277f74034e2a758c435b11fa4a92e61ca56ceca1eec163379f31c273a935d3e
|
|
BLAKE2b-256 checksum How to use checksums |
9811a98ae85c9c434cdbdd7757a5a59c4493f33eb45e61256bf18a93f89e5671
|
| 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.8-py3-none-any.whl
| Download URL | tsdr-0.8-py3-none-any.whl |
|---|---|
| Size | 46.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d103bbf5df147b08335a07796b9b21522c96efa789ab30b75976520fe8bfe265
|
|
BLAKE2b-256 checksum How to use checksums |
045943250fdbf872859ce1c9b488cdc1e4b9319de0d519659b22def7205c3152
|
| 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.8
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.