scipy.spatial.distance.rogerstanimoto¶
- scipy.spatial.distance.rogerstanimoto(u, v, w=None)[源代码]¶
计算两个布尔一维数组之间的Rogers-TAnimoto相异度。
两个布尔一维数组之间的Rogers-TAnimoto相异性 u 和 v ,定义为
\[\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,可选
中每个值的权重 u 和 v 。默认值为None,即为每个值赋予1.0的权重
- 退货
- rogerstanimoto双倍
向量之间的Rogers-TAnimoto相异性 u 和 v 。
示例
>>> 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