当前位置: 首页 > 工具软件 > Daisy > 使用案例 >

R语言中dist()与daisy()函数

慕容明煦
2023-12-01
常用用来计算x矩阵行向量之间的距离的函数有两个。
dist(x,method="euclidean")
  • euclidean: 欧式距离。
  • maximum: 对应元素之间差的最大值。
  • manhattan: 曼哈顿距离,对应元素距离和。
  • canberra: 对应元素 sum(|差|/和)。多用于非负值矩阵以避免分母为零的情况。
  • binary: (aka asymmetric binary):

The vectors are regarded as binary bits, so non-zero elements are ‘on’ and zero elements are ‘off’. The distance is the proportion of bits in which only one is on amongst those in which at least one is on.

  • minkowski: 明氏距离。The p norm, the pth root of the sum of the pth powers of the differences of the components.
daisy(x, metric = c("euclidean", "manhattan", "gower"), stand = FALSE, type = list(), weights = rep.int(1, p))
  • gower: 允许对各个列加权值。
  • stand: 是否对矩阵元素标准化。

转载于:https://my.oschina.net/fazheng/blog/680770

 类似资料: