{"id":14570,"library":"fastdtw","title":"FastDTW","description":"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.","status":"maintenance","version":"0.3.4","language":"en","source_language":"en","source_url":"https://github.com/slaypni/fastdtw","tags":["time series","DTW","dynamic time warping","similarity","approximation","signal processing","distance metric"],"install":[{"cmd":"pip install fastdtw","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required for array manipulation in typical usage.","package":"numpy","optional":false},{"reason":"Commonly used for distance metrics (e.g., euclidean) with fastdtw.","package":"scipy","optional":false}],"imports":[{"symbol":"fastdtw","correct":"from fastdtw import fastdtw"}],"quickstart":{"code":"import numpy as np\nfrom scipy.spatial.distance import euclidean\nfrom fastdtw import fastdtw\n\nx = np.array([[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]], dtype=float)\ny = np.array([[2, 2], [3, 3], [4, 4]], dtype=float)\n\ndistance, path = fastdtw(x, y, dist=euclidean)\n\nprint(f\"DTW Distance: {distance}\")\nprint(f\"Warping Path: {path}\")","lang":"python","description":"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."},"warnings":[{"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.","message":"Contrary 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"The `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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"While 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.","severity":"gotcha","affected_versions":"<=0.3.4"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[],"ecosystem":"pypi"}