scipy.spatial.distance.cdist
2024-08-30 11:45:05
scipy.spatial.distance.cdist(XA, XB, metric='euclidean', p=2, V=None, VI=None, w=None)[source]
Computes distance between each pair of the two collections of inputs.
The following are common calling conventions:
Y = cdist(XA, XB, 'euclidean')
Computes the distance between mm points using Euclidean distance (2-norm) as the distance metric between the points. The points are arranged as mm nn-dimensional row vectors in the matrix X.
>>> a =([1,2],[3,4],[5,6])
>>> a
([1, 2], [3, 4], [5, 6])
>>> b = ([3,4],[7,1])
>>> b
([3, 4], [7, 1])
>>> cdist(a,b)
array([[ 2.82842712, 6.08276253],[ 0. , 5. ],[ 2.82842712, 5.38516481]])
结果数组中第一对第一个值: 【1,2】和 【3,4】的距离;第一对第二个值是【1,2】和【7,1】的距离
最新文章
- Centos下搭建 tomcat https服务器详解(原创)
- css3的2D转换
- Maven之问题解决汇总
- 分支语句:if
- 这是从word发的第一篇博客。
- Dapper试用简例
- ESFramework 4.0 进阶(01)-- 消息
- 【Unity3D技术文档翻译】第1.5篇 本地使用 AssetBundles
- 题目1010:A + B
- PYTHON练习题 二. 使用random中的randint函数随机生成一个1~100之间的预设整数让用户键盘输入所猜的数。
- Android开发:Android Studio开发环境配置
- Vue.js04:vue样式-通过属性绑定方式为元素设置class类样式
- HBase——HMaster启动之一(HMaster的构建)
- ASP.NET Core 添加区域步骤(详细)
- 使用git遇到的一些问题
- mapstruct与lombok结合使用
- TypeError: object() takes no parameters
- font-smoothing使用后字体看起来会更清晰舒服
- 困惑2----(已经OK)
- 函数和常用模块【day04】:函数式编程(六)