aiaiask.com©

开花即结果 提问即答案

点(1,1)和点(2,2)的余弦距离,汉明距离、欧氏距离、曼哈顿距离分别是多少
原始问题:

点(1,1)和点(2,2)的余弦距离,汉明距离、欧氏距离、曼哈顿距离分别是多少

点$(1,1)$和点$(2,2)$的坐标分别为$(1,1)$和$(2,2)$.

余弦距离:

$\cos \theta=\frac{(1,1)\cdot(2,2)-1\times1-1\times2}{\sqrt{1^2+1^2}\times\sqrt{2^2+2^2}}=-\frac{3}{5\sqrt{2}}$,

所以余弦距离为$\sqrt{(1-\frac{3}{5})^2+(1-\frac{3}{5})^2}=\frac{\sqrt{8}}{5}$.

汉明距离:

在两个向量中,不同位置的元素采用不同的符号表示,因此可以按照如下方式计算汉明距离:

$\cos \theta=(1,1)\cdot(2,2)=1$,

所以汉明距离为0.

欧氏距离:

$\cos \theta=\frac{(1,1)\cdot(2,2)-1\times1-1\times2}{\sqrt{1^2+1^2}\times\sqrt{2^2+2^2}}=-\frac{3}{5\sqrt{2}}$,

所以欧氏距离为$\sqrt{(1-\frac{3}{5})^2+(1-\frac{3}{5})^2}=\frac{\sqrt{8}}{5}$.

曼哈顿距离:

在两个向量中,相同位置的元素取相同的符号,不同位置的元素取相反的符号。因此可以按照如下方式计算曼哈顿距离:

$\cos \theta=(1,1)\cdot(2,2)=1$,

所以曼哈顿距离为0.

点(1,1)和点(2,2)的余弦距离,汉明距离、欧氏距离、曼哈顿距离分别是多少
https://www.aiaiask.com/ask/46455.html
AI / 模型Siliconflow
时间 / DATESeptember 8, 2023, 7:14 PM
语言zh-CN
IP / 区域天津市天津市