Skip to main content

A rust implementation of dynamic time warping with python bindings!

Project description

RustDTW

Python extension backed by a multi-threaded Rust implementation of Dynamic Time Warping (DTW).


⚡️ Quick Install

To install rustDTW, simply:

pip install rust-dtw

❓ What is Dynamic Time Warping

In time series analysis, dynamic time warping (DTW) is one of the algorithms for measuring similarity between two temporal sequences, which may vary in speed 1. This has applications in speech recognition, time series classification and neuroscience.

Example Usage

rustDTW was designed for usage with timeseries data from functional brain regions. However any data represented as a numpy matrix can be provided.

import numpy as np
import rust_dtw
  
rust_dtw.dtw(
  s=np.array([0., 1., 2.]), 
  t=np.array([3., 4., 5.]), 
  window=50, 
  distance_mode="euclidean"
  )
>>> 5.0990195

For more examples please see examples/ or explore the wiki.

Developing

Built With

  • PyO3
  • Maturin
  • rust-numpy
  • Rayon

Setting up Dev

To get started with development, simply clone the repository and edit the main library code in src/. Once done, simply build and test the code with ./build.sh.

git clone https://github.com/FL33TW00D/rustDTW.git
cd rust-dtw/
./build.sh

Tests

All tests are implemented using pytest.

poetry run pytest

📈 Performance


The above shows the performance of the rustdtw implementation vs the DTAIDistance OpenMP Python version (more benchmarks vs C implementation coming soon).

⚠️ License

rustDTW is free and open-source software licensed under the MIT License.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

rust_dtw-0.1.14-cp39-none-win_amd64.whl (374.7 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

rust_dtw-0.1.14-cp39-cp39-manylinux_2_24_x86_64.whl (436.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.24+ x86-64

rust_dtw-0.1.14-cp39-cp39-macosx_10_7_x86_64.whl (401.6 kB view hashes)

Uploaded CPython 3.9 macOS 10.7+ x86-64

rust_dtw-0.1.14-cp38-none-win_amd64.whl (375.2 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

rust_dtw-0.1.14-cp38-cp38-manylinux_2_24_x86_64.whl (436.9 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.24+ x86-64

rust_dtw-0.1.14-cp38-cp38-macosx_10_7_x86_64.whl (401.9 kB view hashes)

Uploaded CPython 3.8 macOS 10.7+ x86-64

rust_dtw-0.1.14-cp37-none-win_amd64.whl (375.5 kB view hashes)

Uploaded CPython 3.7 Windows x86-64

rust_dtw-0.1.14-cp37-cp37m-manylinux_2_24_x86_64.whl (436.9 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.24+ x86-64

rust_dtw-0.1.14-cp37-cp37m-macosx_10_7_x86_64.whl (402.1 kB view hashes)

Uploaded CPython 3.7m macOS 10.7+ x86-64

rust_dtw-0.1.14-cp36-none-win_amd64.whl (375.5 kB view hashes)

Uploaded CPython 3.6 Windows x86-64

rust_dtw-0.1.14-cp36-cp36m-manylinux_2_24_x86_64.whl (436.8 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.24+ x86-64

rust_dtw-0.1.14-cp36-cp36m-macosx_10_7_x86_64.whl (402.0 kB view hashes)

Uploaded CPython 3.6m macOS 10.7+ x86-64

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