When using the Librosa library to compute the Dynamic Time Warping matrix between two time series, how does one obtain the minimum distance between the two signals? In Matlab the first returned argument is this distance. In Librosa the returned value is the accumulated cost matrix, with the comment that 'D[N,M] is the total alignment cost.'
Does this mean that the bottom right entry of the D matrix is the minimum distance between the two time series, like the return value in Matlab? If not, how do I obtain the distance from the returned matrix?
The total cost is the accumulated cost at the last point on the optimal path, so:
D, wp = librosa.dtw(X, Y) best_cost = D[wp[-1, 0], wp[-1, 1]]
Depending on the matching mode, the path may not end at