Registry / ai-ml / fastdtw

fastdtw

JSON →
library0.3.4pypiunverified

FastDTW is a Python implementation of the FastDTW algorithm, which provides optimal or near-optimal alignments with an O(N) time and memory complexity for Dynamic Time Warping (DTW) of time series. The current version is 0.3.4, with its last release in October 2019, suggesting a maintenance rather than active development phase.

pip install fastdtw
INSTALL
IMPORT
SIG · FASTDTW
F
fastdtw
ai-mlenv0.3.4
Install
4.6s avg
Import
254ms
Disk
90MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.246s · 90.8MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 4.6s · import 0.261s · 87MB
90MB installed
● package 90MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fastdtw
from fastdtw import fastdtw

This example calculates the Dynamic Time Warping distance and the corresponding warping path between two time series (x and y) using the Euclidean distance metric for point-to-point comparison. Numpy arrays are used for time series data, and scipy's euclidean distance is passed to fastdtw. The 'dist' parameter can accept any function that computes a distance between two points.

import numpy as np from scipy.spatial.distance import euclidean from fastdtw import fastdtw x = np.array([[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]], dtype=float) y = np.array([[2, 2], [3, 3], [4, 4]], dtype=float) distance, path = fastdtw(x, y, dist=euclidean) print(f"DTW Distance: {distance}") print(f"Warping Path: {path}")
Debug
Known issues
gotchaContrary to its name and common perception, recent research suggests that 'fastdtw' can be significantly slower than standard Dynamic Time Warping (DTW) implementations in many realistic data mining applications, while also providing only an approximate result. Users should benchmark performance against exact DTW algorithms for their specific use case.
fix
Consider using alternative DTW implementations (e.g., from `scipy.signal.distance`, `tslearn`, or `dtaidistance`) or constrained DTW (cDTW) which may offer better performance and exact results.
affects: All versions
gotchaThe `fastdtw` algorithm is an approximation, and its accuracy is controlled by the `radius` parameter. A larger `radius` value generally leads to a more accurate, but computationally more expensive, result. If the `radius` is set sufficiently large, FastDTW effectively generalizes to the O(N^2) standard DTW algorithm, losing its linear time complexity advantage.
fix
Carefully select the `radius` parameter based on the desired balance between accuracy and computational efficiency. Understand that increasing the radius beyond a certain point will diminish the 'fast' aspect.
affects: All versions
gotchaWhile the PyPI metadata for `fastdtw` doesn't explicitly declare `requires_python`, the GitHub repository's `Pipfile` suggests Python 3.7. Given the library's last update in 2019, compatibility with very recent Python versions (e.g., 3.10+) should be verified, as dependencies might have evolved.
fix
Test `fastdtw` within your target Python environment. If issues arise, consider using a Python 3.7 or 3.8 environment, or evaluate more actively maintained DTW libraries.
affects: <=0.3.4
Upgrade
Version history
0.3.4latest on PyPI · released Oct 7, 2019
Audit
Dependencies
numpyrequiredRequired for array manipulation in typical usage.
scipyrequiredCommonly used for distance metrics (e.g., euclidean) with fastdtw.
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources

No resource links recorded.

fastdtw — pip install fastdtw · libregistry