slaypni / fastdtw

A Python implementation of FastDTW

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Output of the distance matrix

arturoribes opened this issue · comments

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).

try:

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

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

@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.

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