如何衡量两个系列数据之间的相似性?
我需要找到两个数据数组之间的相似性度量。 您可以将相似性度量称为任何您想要的名称,差异、相关性或任何其他名称。
例如:
1, 2, 3, 4, 5 < Series 1
2, 3, 4, 5, 6 < Series 2
应该比这两个系列更加相似:
1, 2, 3, 4, 5 < Series 1
1, 1, 5, 8, 7 < Series 2
有什么建议吗?
有可用的源代码吗?
I need to find a similarity measurement between two arrays of data.
You can call similarity measurement whatever you want, difference, correlation or whatever.
For example:
1, 2, 3, 4, 5 < Series 1
2, 3, 4, 5, 6 < Series 2
Should be far more similar to each other than these 2 series:
1, 2, 3, 4, 5 < Series 1
1, 1, 5, 8, 7 < Series 2
Any suggestions?
Is there a source code available for it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
另一种方法是计算互信息,matlab 和 C 中有一个用于此目的的工具箱
http://www.cs.man.ac.uk/~pococka4/MIToolbox .html
Another way to do this is to calculate mutual information, there is a toolbox for this in matlab and C
http://www.cs.man.ac.uk/~pococka4/MIToolbox.html
您可以计算样本皮尔逊积矩相关系数:“以上公式表明用于计算样本相关性的方便的单通道算法”。编写一个循环来计算 sum(xi)、sum(yi)、sum(xi^2)、sum(yi^2) 和 sum(xi*yi)。然后将这些总和代入公式中。
You can calculate the sample Pearson product-moment correlation coefficient: "The above formula suggests a convenient single-pass algorithm for calculating sample correlations". Write a loop to calculate sum(xi), sum(yi), sum(xi^2), sum(yi^2), and sum(xi*yi). Then insert these sums into the formula.
如果您对相似性的定义是有多少相同的元素,则可以使用集合交集:
If your definition of similarity is how much same elements there are you can use set intersection: