Skip to main content

tsdistances is a Python library (with Rust backend) for computing various pairwise distances between sets of time series data. It provides efficient implementations of elastic distance measures such as Dynamic Time Warping (DTW), Longest Common Subsequence (LCSS), and Time Warping Edit (TWE). The library is designed to be fast and scalable, leveraging parallel computation for improved performance.

Project description

tsdistances

tsdistances is a Python library (with Rust backend) for computing various pairwise distances between sets of time series data. It provides efficient implementations of elastic distance measures such as Dynamic Time Warping (DTW), Longest Common Subsequence (LCSS), Time Warping Edit (TWE), and many others. The library is designed to be fast and scalable, leveraging parallel computation and GPU support via Vulkan for improved performance.

Features

  • Multiple Distance Measures: Supports a wide range of time series distance measures:

    • Euclidean
    • CATCH22 Euclidean
    • Edit Distance with Real Penalty (ERP)
    • Longest Common Subsequence (LCSS)
    • Dynamic Time Warping (DTW)
    • Derivative Dynamic Time Warping (DDTW)
    • Weighted Dynamic Time Warping (WDTW)
    • Weighted Derivative Dynamic Time Warping (WDDTW)
    • Amerced Dynamic Time Warping (ADTW)
    • Move-Split-Merge (MSM)
    • Time Warp Edit Distance (TWE)
    • Shape-Based Distance (SBD)
    • MPDist
  • Parallel Computation: Utilizes multiple CPU cores to speed up computations.

  • GPU Acceleration: Optional GPU support using Vulkan for even faster computations.

Installation

From Source

To install tsdistances from source, follow these steps:

$ git clone https://github.com/albertoazzari/tsdistances/
$ cd tsdistances
$ python -m venv .venv
$ source .venv/bin/activate
$ pip install maturin
$ maturin develop --release

PIP

If you use pip, you can install tsdistances with:

pip install tsdistances

Usage

Here's a basic example of using tsdistances to compute the Dynamic Time Warping (DTW) distance between two set of time series:

import numpy as np
import tsdistances

# Example usage of computing DTW distance
x1 = np.array([
    [1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0]
])

x2 = np.array([
    [7.0, 8.0, 9.0],
    [10.0, 11.0, 12.0]
])

# Compute DTW distance
result = tsdistances.dtw(x1, x2, n_jobs=4, device='cpu')
print(result)

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

tsdistances-0.0.6.tar.gz (81.2 kB view details)

Uploaded Source

Built Distributions

tsdistances-0.0.6-cp312-cp312-musllinux_1_2_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.12 musllinux: musl 1.2+ x86-64

tsdistances-0.0.6-cp312-cp312-musllinux_1_2_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.12 musllinux: musl 1.2+ ARM64

tsdistances-0.0.6-cp312-cp312-manylinux_2_35_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.35+ x86-64

tsdistances-0.0.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

tsdistances-0.0.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

File details

Details for the file tsdistances-0.0.6.tar.gz.

File metadata

  • Download URL: tsdistances-0.0.6.tar.gz
  • Upload date:
  • Size: 81.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.7.4

File hashes

Hashes for tsdistances-0.0.6.tar.gz
Algorithm Hash digest
SHA256 07b44616ad13385bb97eaaab04d3cdd79757c10a444866bf30623fb0c3adbc29
MD5 4a5d4399498c50830bb720ff6edfce8b
BLAKE2b-256 aa92b3102e02066de68b1bdcca99fb63af9b5fe46d9f470476dfe0ec52a60e31

See more details on using hashes here.

File details

Details for the file tsdistances-0.0.6-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tsdistances-0.0.6-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 22a5e49b27913395dc9d2e7aa3fb1e046ef18f2867adb3ccf266a9390ba0bf0e
MD5 19d3e60d02f710c53ee8c361a52d32ad
BLAKE2b-256 c13cb63a8d19df197e198cb164b49e739f1a4b812cee11eaee9ca346a9d2177b

See more details on using hashes here.

File details

Details for the file tsdistances-0.0.6-cp312-cp312-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for tsdistances-0.0.6-cp312-cp312-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 fd0f7c6eee964c5cb8ff6535099fa9ca84512c2e1235a735b25bb92a1aa57843
MD5 16a4c0351053f5a91faeed9da846060a
BLAKE2b-256 ee9257df77fc4758ce764dc463f92bcbf4d3f8e563e910d5ea3c86eac30d8189

See more details on using hashes here.

File details

Details for the file tsdistances-0.0.6-cp312-cp312-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for tsdistances-0.0.6-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 ca1251386b9f211f595bfc326eeed38bf1e06219400c99d6cfe1939fc6453dc1
MD5 190a73827b5f952e12801e88f6b4b911
BLAKE2b-256 3a435b0af4a750f09292e690177e8bae40aec7b46d89a41fb782737dd94bc994

See more details on using hashes here.

File details

Details for the file tsdistances-0.0.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tsdistances-0.0.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7e615648840ddf8bc64a21a059708fddc1f5e36a54d20107fa45428e9494128a
MD5 7c22b98d2116182dd49da18bbda8c4f8
BLAKE2b-256 be696dbbde1631876de815d69e70ee01499af4e998d867cb9018ed235c35c7af

See more details on using hashes here.

File details

Details for the file tsdistances-0.0.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tsdistances-0.0.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4a03f09d1c766dce202d2ba02d41b42416fd402db8484600d83d69a32e61d5a7
MD5 c5d7c4c533d982ea6780b3e49356e0ae
BLAKE2b-256 74587dfa481542c20007f26840da7bf74a4c02e6ce2c5cd146cba6c17557617a

See more details on using hashes here.

Supported by

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