scipy.spatial.distance.rogerstanimoto

scipy.spatial.distance.rogerstanimoto(u, v, w=None)[源代码]

计算两个布尔一维数组之间的Rogers-TAnimoto相异度。

两个布尔一维数组之间的Rogers-TAnimoto相异性 uv ,定义为

\[\crc{R} {c_{TT}+c_{FF}+R}\]

哪里 \(c_{{ij}}\) 是出现的次数 \(\mathtt{{u[k]}} = i\)\(\mathtt{{v[k]}} = j\)\(k < n\)\(R = 2(c_{{TF}} + c_{{FT}})\)

参数
u(n,)类似数组,布尔

输入数组。

v(n,)类似数组,布尔

输入数组。

w(n,)array_like,可选

中每个值的权重 uv 。默认值为None,即为每个值赋予1.0的权重

退货
rogerstanimoto双倍

向量之间的Rogers-TAnimoto相异性 uv

示例

>>> from scipy.spatial import distance
>>> distance.rogerstanimoto([1, 0, 0], [0, 1, 0])
0.8
>>> distance.rogerstanimoto([1, 0, 0], [1, 1, 0])
0.5
>>> distance.rogerstanimoto([1, 0, 0], [2, 0, 0])
-1.0