mlpy - 动态时间规整主要依靠X? [英] mlpy - Dynamic Time Warping depends on x?

查看:301
本文介绍了mlpy - 动态时间规整主要依靠X?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得由大田下面显示这两个数组之间的距离。

I am trying to get the distance between these two arrays shown below by DTW.

我使用Python mlpy 软件包,提供了

I am using the Python mlpy package that offers

dist, cost, path = mlpy.dtw_std(y1, y2, dist_only=False)

据我所知,大田确实照顾了转移的。此外,如可以从上面所看到的,在 mlpy.dtw_std()只需要在2 1-D阵列。所以我希望,不管我怎么左/右移我的曲线,在 DIST 返回的功能应该不会改变。

I understand that DTW does take care of the "shifting". In addition, as can be seen from above, the mlpy.dtw_std() only takes in 2 1-D arrays. So I expect that no matter how I left/right shift my curves, the dist returned by the function should never change.

后移但我的绿色曲线有点权, DIST mlpy.dtw_std返回()的变化!

However after shifting my green curve a bit to the right, the dist returned by mlpy.dtw_std() changes!

,然后改成:Python的 mlpy.dwt_std 报告 DIST = 14.014

Before shifting: Python mlpy.dwt_std reports dist = 14.014

后移:Python的 mlpy.dwt_std 报告 DIST = 38.078 很明显,由于曲线仍然是这两个曲线,我不期望的距离是不同的!

After shifting: Python mlpy.dwt_std reports dist = 38.078 Obviously, since the curves are still those two curves, I don't expect the distances to be different!

为什么会这样呢?哪里出了问题?

推荐答案

让我重申我也明白了,请纠正我,如果我错了任何地方。我观察到,在这两个你的情节,你的1D系列以蓝色其余完全相同,而绿色的是越来越捉襟见肘。你是如何做的,你已经在9:36解释它在09月19 '13后。您的premise是因为:(1)DTW'照顾'时移和(2)所有你正在做的是绵延一时间序列长度明智的,不影响y值,(推理:)你期待距离仍保持不变。

Let me reiterate what I have understood, please correct me if I am going wrong anywhere. I observe that in both your plots, your 1D series in blue is remaining identical, while green colored is getting stretched. How you are doing it, that you have explained it in the post on Sep 19 '13 at 9:36. Your premise is that because (1) DTW 'takes care' of time shift and (2) all that you are doing is stretching one time-series length-wise, not affecting y-values, (Inference:) you are expecting distance to remain the same.

之间存在小缺失的环节[(1),(2)]和[(推论)。其中,对应于映射各个距离值会随着您更改设置的信号本身。而这将导致成整体距离计算差异。 绘制扭曲的路径,成本栅格看到它自己。

There is a little missing link between [(1),(2)] and [(Inference)]. Which is, individual distance values corresponding to mappings WILL change as you change set of signals itself. And this will result into difference in the overall distance computation. Plot the warping paths, cost grid to see it for yourself.

让我们举一个过分简单化的情况下...

Let's take an oversimplified case...

A =范围(0,101,5) = [0,5,10,15 ...... 95,100]

Let a=range(0,101,5) = [0,5,10,15...95, 100]

B =范围(0,101,5) = [0,5,10,15 ...... 95,100]。

and b=range(0,101,5) = [0,5,10,15...95, 100].

现在直观地说,你/我希望一个2信号(DTW映射),并距离所有的映射关系一一对应为0,信号是相同的期待。

Now intuitively speaking, you/I would expect one to one correspondence between 2 signals (for DTW mapping), and distance for all of the mappings to be 0, signals being identically looking.

现在,如果我们做, B =范围(0,101,4) = [0,4,8,12 ... 96100] a和b间的DTW映射仍然将开始与一个是0得到映射至b的0,并结束于一个100得到映射至b的100(边界约束)。同时,由于大田'照顾'时移的,我也希望20年代,40年代,60年代和80年代的两个信号被映射到另一个。 (我没有尝试过DTWing这两个自己,从直觉这么说了,那么请检查一下。还有就是非直观的warpings发生为好,这取决于步模式允许/全局约束的可能性不大,但让我们一起去直观warpings的的时刻为便于理解/简单起见)。

Now if we make, b=range(0,101,4) = [0,4,8,12...96,100], DTW mapping between a and b still would start with a's 0 getting mapped to b's 0, and end at a's 100 getting mapped to b's 100 (boundary constraints). Also, because DTW 'takes care' of time shift, I would also expect 20's, 40's, 60's and 80's of the two signals to be mapped with one another. (I haven't tried DTWing these two myself, saying it from intuition, so please check. There is little possibility of non-intuitive warpings taking place as well, depending on step patterns allowed / global constraints, but let's go with intuitive warpings for the moment for the ease of understanding / sake of simplicity).

有关的剩余的数据点,显然,相应于映射距离是现在为非零,因此整体的距离太不为零。我们的距离/总成本值已从零改变到的东西是非零。

For the remaining data points, clearly, distances corresponding to mapping are now non-zero, therefore the overall distance too is non-zero. Our distance/overall cost value has changed from zero to something that is non-zero.

现在,这是当我们的信号过于简单,线性增加的情况下。想象一下,将进入画面时,你有真实的生活不单调信号,需要找时间翘曲它们之间的变异。 :)

Now, this was the case when our signals were too simplistic, linearly increasing. Imagine the variabilities that will come into picture when you have real life non-monotonous signals, and need to find time-warping between them. :)

(PS:请不要忘记upvote答案:D)。谢谢你。

(PS: Please don't forget to upvote answer :D). Thanks.

这篇关于mlpy - 动态时间规整主要依靠X?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆