关于Python中的mlpy.dtw软件包的两个问题? [英] Two Issues about mlpy.dtw package in Python?

查看:129
本文介绍了关于Python中的mlpy.dtw软件包的两个问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为动态时间规整(DTW)的新手,我发现它的Python实现 mlpy. dtw 没有详细记录.我对它的返回值有一些疑问.

As a newbie in Dynamic Time Warping (DTW), I find its Python implementation mlpy.dtw is not documented in a very detailed extend. I have some problems with its return value.

关于返回值dist?我有两个问题:

  • 此处有任何错字吗?对于标准DTW,文档说
  • Any typo here? For standard DTW, the document says

如[Muller07]中所述的标准DTW,使用欧几里德距离 (差异的绝对值)或欧几里德距离的平方(为 在[Keogh01]中作为本地成本计量.

Standard DTW as described in [Muller07], using the Euclidean distance (absolute value of the difference) or squared Euclidean distance (as in [Keogh01]) as local cost measure.

对于DTW子序列,该文件说

and for subsequence DTW, the document says

如[Muller07]中所述,

子序列DTW,假设长度为 y的x远大于x的长度,并使用 Manhattan 距离(差的绝对值)作为本地成本度量.

Subsequence DTW as described in [Muller07], assuming that the length of y is much larger than the length of x and using the Manhattan distance (absolute value of the difference) as local cost measure.

相同的所谓差的绝对值"对应两个不同的距离度量?

The same so-called "absolute value of the difference" corresponds two different distance metrics?

  • 总距离?运行代码段后

dist,cost,path = mlpy.dtw_std(x,y,dist_only = False)

dist, cost, path = mlpy.dtw_std(x, y, dist_only=False)

dist是一个值. 是每个匹配对之间的所有距离的总和吗?

推荐答案

是的,mlpy.dtw()函数没有充分的文档记录.

Yes, the mlpy.dtw() function is not well documented.

  • 第一个问题:此处没有错字.您可以在文档中看到,欧几里得距离,平方欧几里得距离和曼哈顿距离与本地成本衡量有关.在这种情况下,成本测度定义为两个实数值(一维)之间的距离,请参见 http://en.wikipedia. org/wiki/Euclidean_distance#One_dimension ).无论如何,在标准dtw中,您可以通过参数 squared :
  • 选择欧几里德距离(差的绝对值)或平方欧几里德距离(平方差):
  • First question: no typo here. As you can see in the documentation, euclidean, squared euclidean and manhattan distances concern the local cost measure. In this case the cost measure is defined as a distance between two real values (one dimension), see cost in the pseudocode in http://en.wikipedia.org/wiki/Dynamic_time_warping. So, in this case, Manhattan distance and Euclidean distance are the same (http://en.wikipedia.org/wiki/Euclidean_distance#One_dimension). Anyway, in the standard dtw, you can choose the euclidean distance (absolute value of the difference) or the squared euclidean distance (squared difference) by the parameter squared:
>>> import mlpy
>>> mlpy.dtw_std([1,2,3], [4,5,6], squared=False) # Euclidean distance
9.0
>>> mlpy.dtw_std([1,2,3], [4,5,6], squared=True) # Squared Euclidean distance
26.0

  • 第二个问题: dist 是时间序列x和y之间的未归一化最小距离翘曲路径.它是未归一化的DTW距离.您可以将其除以len(X)+ len(Y)进行归一化.参见 http://www.irit.fr /~Julien.Pinquier/Docs/TP_MABS/res/dtw-sakoe-chiba78.pdf
    • Second question: dist is the unnormalized minimum-distance warp path between time series x and y. It is the unnormalized DTW distance. You can normalize it dividing by len(X)+len(Y). See http://www.irit.fr/~Julien.Pinquier/Docs/TP_MABS/res/dtw-sakoe-chiba78.pdf
    • 干杯, 大卫(Davide)

      Cheers, Davide

      这篇关于关于Python中的mlpy.dtw软件包的两个问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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