フィルターのクリア

DTW metric (euclidean/absolute) strange behavior

4 ビュー (過去 30 日間)
Pere Garau Burguera
Pere Garau Burguera 2021 年 11 月 24 日
編集済み: Pere Garau Burguera 2021 年 11 月 24 日
I have a doubt concerning the Dynamic Time Warping (DTW) function from the Signal Processing Toolbox.
Concretely, when it comes to the different metrics that it has available. It seems to me that the default 'euclidean' is actually 'absolute'. To test this, I have prepared the following script comparing the outputs of the dtw function with the output of the norm function after aligning the signals.
x = rand(30,1);
y = rand(30,1);
[dtw_eucl,ix,iy] = dtw(x,y,'euclidean');
norm_eucl = norm(x(ix)-y(iy),2); % L2 after alignment
[dtw_manh,ix,iy] = dtw(x,y,'absolute');
norm_manh = norm(x(ix)-y(iy),1); % L1 after alignment
dtw_squa = dtw(x,y,'square');
disp("Values for dtw and norm with euclidean distance")
% These should be the same but aren't:
dtw_eucl
norm_eucl
disp("Dtw with euclidean distance has the same result as manhattan distance")
% However, dtw_eucl is the same as these:
dtw_eucl
norm_manh
dtw_manh
disp("DTW_eucl^2 should be the same as the result from using the 'square' metric")
% These should be the same but aren't:
dtw_squa
dtw_eucl2 = dtw_eucl.^2
For example, when running the script I get this:
% Values for dtw and norm with euclidean distance
% dtw_eucl =
% 6.6422
% norm_eucl =
% 1.3285
% Dtw with euclidean distance has the same result as manhattan distance
% dtw_eucl =
% 6.6422
% norm_manh =
% 6.6422
% dtw_manh =
% 6.6422
% DTW_eucl^2 should be the same as the result from using the 'square' metric
% dtw_squa =
% 1.6403
% dtw_eucl2 =
% 44.1183
Showing that there is some problem with the implementation of dtw with 'euclidean' metric. Any ideas as to why this might be?

回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by