fastdtw Documentation

repository·master·Indexed 21 days ago

https://github.com/slaypni/fastdtw

A Python implementation of the FastDTW algorithm that provides an approximate Dynamic Time Warping solution with linear O(N) time and memory complexity. It calculates the distance and optimal alignment path between two sequences using a provided distance function.

Tokens
244
Snippets
2
Records
2
Agent score
25%

What's inside fastdtw

  1. Use the fastdtw function for approximate DTW

    master

    The fastdtw function implements an approximate Dynamic Time Warping algorithm with $O(N)$ time and memory complexity. It calculates the distance and the optimal alignment path between two sequences.

    To use it, pass two arrays (e.g., NumPy arrays) and a distance function (such as scipy.spatial.distance.euclidean) to the fastdtw function.

    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]])
    y = np.array([[2,2], [3,3], [4,4]])
    
    distance, path = fastdtw(x, y, dist=euclidean)
    print(distance)