Skip to main content

Time-series dimension reduction

Project description

tsdr: Time-Series Dimension Reduction

About

Time-series dimension reduction (TSDR) methods are a class of algorithms for the dimension reduction of multivariate data that exploit temporal structure. As compared to general dimension reduction (GDR) methods, the outputs of which are invariant to temporal permutation, TSDR methods are sensitive to temporal structure.

The figure above visually summarises the categories of TSDR methods that we defined in Owens & Fulcher (2025). The first five categories (a-e) consist of methods that extract time-series components based on different aspects of temporal structure, i.e., slowness, autocorrelation, predictability, determinism, and non-stationarity. The final two categories (f-g) consist of methods that share a common methodology, i.e., diffusion-based and latente variable methods.

The tsdr package provides python implementations of TSDR methods from each of these seven categories. The methods are written in a simple, readable style to enable time-series analysts to better understand a subset of the TSDR methods discussed in the Owens & Fulcher (2025) review paper.

Acknowledgement :

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

Installation

Using pip for tsdr:

pip install tsdr

Usage

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 = 10
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)

# visualise 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()

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tsdr-0.1.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tsdr-0.1-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file tsdr-0.1.tar.gz.

File metadata

  • Download URL: tsdr-0.1.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for tsdr-0.1.tar.gz
Algorithm Hash digest
SHA256 1d268700b76bf3f8ba74d03bf39f5fb0697724eb66aae88971118e7f0618b65c
MD5 47f94945a0361619ffc10a5bb8bb4cc6
BLAKE2b-256 0769574dd1fab54deba1e4296fb3571acc24d1952e75de3f2a1e5adb8b08c958

See more details on using hashes here.

File details

Details for the file tsdr-0.1-py3-none-any.whl.

File metadata

  • Download URL: tsdr-0.1-py3-none-any.whl
  • Upload date:
  • Size: 26.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for tsdr-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d569e73dbc1ece50f0bc0d37abc39b7556f3ba06a22fef811868963e76234767
MD5 dfbaf9bf635a47c063fd9d9f25e0fff8
BLAKE2b-256 9d65e5384c1bdebe3d53b2504c038c278e04261f67a3d8ec05972db6978d5605

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page