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
Built Distributions
File details
Details for the file tsdistances-0.0.7.tar.gz
.
File metadata
- Download URL: tsdistances-0.0.7.tar.gz
- Upload date:
- Size: 81.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ec57297f3a0f26d9b44561686db9d5d6684d7c5410cab8c0dd71b9692a037e3 |
|
MD5 | 4dc18cf645222c56373c668c9542e7e2 |
|
BLAKE2b-256 | 7a1cc9edf8ca0e6c359ff5d3edb31cb4570ad8489c4f93e77baf4959a53a62b5 |
File details
Details for the file tsdistances-0.0.7-cp312-cp312-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: tsdistances-0.0.7-cp312-cp312-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.12, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b65e50cec48a75cc9177753a4434170a610a545bbb5f67d9e431d6d6ee0a0e13 |
|
MD5 | 4b361dd9367d0dc1a8ada87ee29902ea |
|
BLAKE2b-256 | c55782f249b850b50a23596cd148582cee4c1af2dd450006f8f13361f8ed0e84 |
File details
Details for the file tsdistances-0.0.7-cp312-cp312-musllinux_1_2_aarch64.whl
.
File metadata
- Download URL: tsdistances-0.0.7-cp312-cp312-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.12, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91a1b8e25ca8c071481adb1c92e240606c053a6f5f47738b6297c51cd7986eb9 |
|
MD5 | 7bcfbdf647f626722c0270a673e36b9d |
|
BLAKE2b-256 | 803431806d4baebd1a73378a4c4a9cc7fc6599cfa4e41d4bbf8e04d61656b54d |
File details
Details for the file tsdistances-0.0.7-cp312-cp312-manylinux_2_35_x86_64.whl
.
File metadata
- Download URL: tsdistances-0.0.7-cp312-cp312-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.12, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf0f0974d22802cf55b1d8b35821d4a5db94f13758016ce790f38105562f7e47 |
|
MD5 | 6a2b442b00d5328e2ec0f315fde02649 |
|
BLAKE2b-256 | 42eda7b4b2dde6b1867fdc40348aa10f9b853ec588cace4e4615ef53b3a2da8d |
File details
Details for the file tsdistances-0.0.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: tsdistances-0.0.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6da569e0a604e1ca819f53705d33b653134f085437cd04f8a8b2a981438005c |
|
MD5 | 4ecd2b5587f2d19bf6ac223da39ca11f |
|
BLAKE2b-256 | 12330bda01de9d2579d47641b4c6726e36911f953d130b5e2e3b91c3f72981aa |
File details
Details for the file tsdistances-0.0.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: tsdistances-0.0.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 385549b1b3c9fb7b0534731e6111b765deab07046df8bd034a2443c2b2be48ae |
|
MD5 | fb29a9e6a1406fb6eae5bb8cfdca2b60 |
|
BLAKE2b-256 | dfac285c2703733743846294bccdf2587daa1b2bfa3b9c35f0561f02f91daf9b |