scipy.spatial.distance.cdist(XAXBmetric='euclidean'p=2V=NoneVI=Nonew=None)[source]

Computes distance between each pair of the two collections of inputs.

The following are common calling conventions:

  1. 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】的距离

最新文章

  1. Centos下搭建 tomcat https服务器详解(原创)
  2. css3的2D转换
  3. Maven之问题解决汇总
  4. 分支语句:if
  5. 这是从word发的第一篇博客。
  6. Dapper试用简例
  7. ESFramework 4.0 进阶(01)-- 消息
  8. 【Unity3D技术文档翻译】第1.5篇 本地使用 AssetBundles
  9. 题目1010:A + B
  10. PYTHON练习题 二. 使用random中的randint函数随机生成一个1~100之间的预设整数让用户键盘输入所猜的数。
  11. Android开发:Android Studio开发环境配置
  12. Vue.js04:vue样式-通过属性绑定方式为元素设置class类样式
  13. HBase——HMaster启动之一(HMaster的构建)
  14. ASP.NET Core 添加区域步骤(详细)
  15. 使用git遇到的一些问题
  16. mapstruct与lombok结合使用
  17. TypeError: object() takes no parameters
  18. font-smoothing使用后字体看起来会更清晰舒服
  19. 困惑2----(已经OK)
  20. 函数和常用模块【day04】:函数式编程(六)

热门文章

  1. Express + Mongoose 极简入门
  2. golang defer那些坑
  3. OpenCV学习笔记(10)——图像梯度
  4. Win10卸载预装应用
  5. python - lambda 函数使用
  6. 什么是web语义化,有什么好处
  7. 阶段3 2.Spring_09.JdbcTemplate的基本使用_4 JdbcTemplate的CRUD操作
  8. C# 中的字符串内插
  9. cocos2dx基础篇(5) 按钮
  10. javase程序设计上机作业2