Skip to main content

Persistent homology of time series via horizontal and non-horizontal filtrations.

Project description

time-series-homology

Compute persistent homology for univariate or multivariate time series using horizontal and non-horizontal filtrations, as described in [1] and [2], respectively.

The main entry point is tsh.TimeSeriesHomology, which largely follows the API conventions from scikit-learn.

Installation

Install from PyPI:

pip install -U time-series-homology

Install from source:

git clone https://github.com/m-a-huber/time-series-homology.git
cd time-series-homology
pip install -e .

Quick start

import numpy as np
from tsh import TimeSeriesHomology

# A univariate time series represented as (time, value) pairs
t = np.linspace(0, 4 * np.pi, 200)
ts = np.column_stack([t, np.sin(t)])

model = TimeSeriesHomology(
    filtration_type="horizontal",
    use_extended_persistence=True,
)

# Input is a list of time series; each element is an array of shape
# (n_time_steps, n_features + 1), where column 0 is time.
persistence = model.fit_transform([ts])

Input and output format

Input:

  • A list of arrays, where each array has shape (n_time_steps, n_features + 1);
  • column 0 stores time values; and
  • columns 1 through n store the signal coordinates.

Output:

  • An object of type list[list[list[list[np.ndarray]]]], where the first axis indexes input time series;
  • the second axis indexes signal coordinates (that is, columns 1 through n in each input array);
  • the third axis indexes diagram families (ordinary/relative/essential for extended persistence, ordinary only otherwise); and
  • the fourth axis indexes homology dimensions, so that the array at index i contains (birth, death) pairs for homology dimension i.

When use_extended_persistence=True, each coordinate returns three diagram families (ordinary, relative, essential). Otherwise, ordinary persistence is used and it returns one family.

Key parameters

  • filtration_type: one of horizontal, sloped, sigmoid, arctan
  • slope: controls the non-horizontal sweeping function for sloped/sigmoid/arctan
  • padding_factor: stabilization padding used by sigmoid and arctan
  • use_extended_persistence: switch between extended and ordinary persistence
  • min_persistence: persistence threshold for filtering generators
  • drop_inf_persistence: drop infinite-lifespan generators for ordinary persistence output
  • n_jobs: parallel processing setting via joblib

For details, use:

from tsh import TimeSeriesHomology
help(TimeSeriesHomology)

References

[1] Lara Ost, Sebastiano Cultrera di Montesano, and Herbert Edelsbrunner. Banana Trees for the Persistence in Time Series Experimentally. 41st International Symposium on Computational Geometry (SoCG 2025). https://doi.org/10.4230/LIPIcs.SoCG.2025.71

[2] Marius Huber, David Robert Reich, and Lena Ann Jäger. 2026. Fixation Sequences as Time Series: A Topological Approach to Dyslexia Detection. In Proceedings of the 2026 Symposium on Eye Tracking Research and Applications (ETRA '26). Association for Computing Machinery, New York, NY, USA, Article 12, 1–13. https://doi.org/10.1145/3797246.3803045

Project details


Download files

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

Source Distribution

time_series_homology-0.1.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

time_series_homology-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file time_series_homology-0.1.0.tar.gz.

File metadata

  • Download URL: time_series_homology-0.1.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for time_series_homology-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d70addfcc5cf38dd1bec51273d03dce1f43812f86059f9678a1589db64d618c
MD5 aca3415c7f4eac97c27faf6380f2fb6b
BLAKE2b-256 5fcacbd4e1dc62ba6200a138902e525eb5413e1002f81ae3850e412da44c042d

See more details on using hashes here.

File details

Details for the file time_series_homology-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for time_series_homology-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04fafe2f28c94c544ab459911c00327e1b6fd4e7c3e01cc4601f6833abc672ee
MD5 ceae7749d2c4c091841c8963669f2784
BLAKE2b-256 267e8b92efc0dea415734060162d149888c7b7dcc2e4159693028233fdb9afec

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