Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 不同长度序列的R RFR中的DTW包_Python_R_Matlab_Dtw - Fatal编程技术网

Python 不同长度序列的R RFR中的DTW包

Python 不同长度序列的R RFR中的DTW包,python,r,matlab,dtw,Python,R,Matlab,Dtw,我在R中的一个列表中有多个不同长度的序列。我想构造DTW距离矩阵,用于分层聚类。在R中运行以下命令时: a2<-dtw(Data[[1]][1],Data[[1]][2]) Error in dtw(Data[[1]][1], Data[[1]][2]) : No warping path exists that is allowed by costraints 我想得到上述输入的距离矩阵。在寻求帮助时,您应该包括一个简单的示例输入和所需的输出,用于测试和验证可能的解决方案。如果

我在R中的一个列表中有多个不同长度的序列。我想构造DTW距离矩阵,用于分层聚类。在R中运行以下命令时:

a2<-dtw(Data[[1]][1],Data[[1]][2])

Error in dtw(Data[[1]][1], Data[[1]][2]) : 
  No warping path exists that is allowed by costraints

我想得到上述输入的距离矩阵。

在寻求帮助时,您应该包括一个简单的示例输入和所需的输出,用于测试和验证可能的解决方案。如果您的系列有非常不同的长度,您将得到该错误,并且无法避免(考虑到您甚至没有使用窗口约束)。请检查并注意,
dtwclust
实现返回无穷大,而不是像
dtw
那样抛出错误。仔细想想,如果您确实使用了
dtw
版本,可能会使用其
open.begin
/
open.end
参数,假设这对您的数据有意义。感谢您的回复响应。如果我每次都通过将两个时间序列放在一起手动计算距离。就像两个for loop nested并计算dtw距离一样。这会像两个时间序列之间的矩阵距离,其中0位于主对角线中吗?要进行聚类,我可以将此矩阵输入输入到hclust in R中吗?是的,但您不必这样做通常,您可以使用
proxy::dist
Update: Input : 1 1 2 5 6 7 2 4
                 2 1 1 2 4 5 3 3 2 2 1
                 1 2 1 1 2 3 1 2 1 2 6 6 5
                 1 2 3 5 6 2 4 2 2 3