slaypni / fastdtw

A Python implementation of FastDTW
MIT License
793 stars 123 forks source link

Output of the distance matrix #14

Open arturoribes opened 7 years ago

arturoribes commented 7 years ago

Is it possible to output the distance matrix? Right now it is just the distance and the path (which can also be obtained from the distance matrix).

glfeng318 commented 6 years ago

try:

import scipy.spatial.distance as ssd
dist = ssd.pdist(df, lambda x1, x2: fastdtw.fastdtw(x1, x2,dist=euclidean))
ssd.squareform(dist)
rachitagrwl commented 6 years ago

Can we implement Manhattan distance and call it without using scipy library.?

arturoribes commented 6 years ago

@feng5 I don't quite understand your example. What is df? From the docs, it should be an array of m observations in n-dimensional space. In my case, I want the distance matrix that fastdtw uses to obtain the alignment between 2 sequences of different lengths in a d-dimensional space.

arturoribes commented 6 years ago

@rachitagrwl of course, you can provide your distance as a two-parameter function