The Dynamic Time Warping algorithm is implemented in version 11 as WarpingDistance and WarpingCorrespondence. It allows some flexibility in terms of the distance function used -- I'm wondering if it can take a custom distance function in the same way that Nearest can take a user-defined distance. When I try it:
s1 = {0, 0, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 6};
s2 = {1, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7};
f[x1_, x2_] := (x1 - x2)^2;
{n, m} = WarpingCorrespondence[s1, s2, DistanceFunction -> f];
the error is:
WarpingCorrespondence::invdist: The distance function f is not supported.
(I am actually interested in a non-Euclidean distance function, but thought I would keep it simple for the question). Am I somehow misunderstanding how to specify the DistanceFunction, or is there perhaps some workaround?
Comments
Post a Comment