`

Distance And Dissimilarity

 
阅读更多

Distance And Dissimilarity

 

本文收集的用来描述空间距离的公式。注意有些并不能称为是Distance,因其不满足欧式空间的不等式特性;但是这些公式在某些程度上也描述了空间中向量的差异性,所以被称为是Dissimilarity。本文暂不区分DistanceDissimilarity,统一用Distance看待,方便描述;各位看官心中要有这些区分。

 

对于空间向量U和V,其中U=[u1,u2,...ui,...un].T,V=[v1,v2,...vi,...vn].T,U和V是空间n维向量,T表示转置为列向量。U和V的Distance可以有如下表示方法,各个方法的侧重点是不一样的;如何选择合适的Distance,就看各位的功力了。

braycurtis: the Bray-Curtis distance.

 

canberra: the Canberra distance.

 

chebyshev: the Chebyshev distance.

 

cityblock: the Manhattan distance.

 

correlation: the Correlation distance.

 

cosine: the Cosine distance.

 

dice: the Dice dissimilarity.

 

euclidean: the Euclidean distance.

 

hamming: the Hamming distance.

 

jaccard: the Jaccard distance.

 

kulsinski: the Kulsinski distance.

 

mahalanobis: the Mahalanobis distance.

 

matching: the matching dissimilarity.

 

minkowski: the Minkowski distance.

 

rogerstanimoto: the Rogers-Tanimoto dissimilarity.

 

russellrao: the Russell-Rao dissimilarity.

 

sokalmichener: the Sokal-Michener dissimilarity.

 

sokalsneath: the Sokal-Sneath dissimilarity.

 

sqeuclidean: the squared Euclidean distance.

 

yule: the Yule dissimilarity.

 

解释:

Cff:表示U和V在相同维度上的值都是False的个数

Cft:表示U和V在相同维度上的值分别为False、True的个数

Ctt:表示U和V在相同维度上的值都是True的个数

Ctf:表示U和V在相同维度上的值分别为True、False的个数

上面的这四个数值的输入向量应该为True或者False,如果不为True、False类型的话,就需要转换一下才能使用到相关度量。

 

上面提到的Distance度量有些很常见,如chebyshev、Cityblock、euclidean、cosine等,有些Distance度量则是显得专业了许多。不过这些Distanced度量都是从某种程度上对Vector的相似性进行衡量,如果使用到某种度量,对于公式又不熟的话,可以查询下。更为细节的Distance度量的场景使用,则还需要根据具体的业务来决定。

 

 上面提到的这些Distance度量在专业的数学工具里都有实现,如matlab、R等,我这里提供一个scipy的实现,http://docs.scipy.org/doc/scipy-dev/reference/spatial.distance.html#module-scipy.spatial.distance,大家可以看下。实际上对于上面的Distance提到的公式,相信实现对于各位来说也不是问题。

 

  • 大小: 7 KB
  • 大小: 4.8 KB
  • 大小: 3.4 KB
  • 大小: 3.8 KB
  • 大小: 6.8 KB
  • 大小: 4.9 KB
  • 大小: 7 KB
  • 大小: 3.3 KB
  • 大小: 8.8 KB
  • 大小: 6.9 KB
  • 大小: 7.3 KB
  • 大小: 6.1 KB
  • 大小: 6.6 KB
  • 大小: 4.4 KB
  • 大小: 8.3 KB
  • 大小: 6.7 KB
  • 大小: 8.5 KB
  • 大小: 7.5 KB
  • 大小: 3.3 KB
  • 大小: 8.2 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics