当前位置:网站首页>Introduction to Cosine Distance
Introduction to Cosine Distance
2022-08-03 19:11:00 【xiaozheng123121】
目录
作者:CSDN博主「深度学习视觉」
原文链接:https://blog.csdn.net/lucky_kai/article/details/89514868
————————————————
概述: 在机器学习领域中,通常将特征表示为向量的形式,所以在分析两个特征向量之间的相似性时,Commonly used cosine similarity representation.
For example, two articles are vectorized,Cosine distance can avoid large distances due to different lengths of articles,The cosine distance only considers the angle between the vectors generated by the two articles.
余弦相似度的取值范围是[-1,1],相同两个向量的之间的相似度为1.
余弦距离的取值范围是[0,2].
The definition formula of cosine similarity is c o s ( A , B ) = A ⋅ B ∥ A ∥ 2 ∥ B ∥ 2 cos(A,B)=\frac{A\cdot B}{\left\|A \right\|_2\left\|B \right\|_2} cos(A,B)=∥A∥2∥B∥2A⋅B
归一化后: ∥ A ∥ 2 = 1 , ∥ B ∥ 2 = 1 , ∥ A ∥ 2 ∥ B ∥ 2 = 1 \left\|A\right\|_2=1, \left\|B\right\|_2=1, \left\|A\right\|_2\left\|B\right\|_2=1 ∥A∥2=1,∥B∥2=1,∥A∥2∥B∥2=1
余弦距离: d i s t ( A , B ) = 1 − c o s ( A , B ) = ∥ A ∥ 2 ∥ B ∥ 2 − A ⋅ B ∥ A ∥ 2 ∥ B ∥ 2 dist(A,B)=1-cos(A,B)=\frac{\left\|A \right\|_2\left\|B \right\|_2-A\cdot B}{\left\|A \right\|_2\left\|B \right\|_2} dist(A,B)=1−cos(A,B)=∥A∥2∥B∥2∥A∥2∥B∥2−A⋅B,distance is greater than0
欧式距离:
It can be seen from the formula that after normalization,There is a monotonic relationship between Euclidean distance and cosine distance.At this time, the value range of both distances is [0,2].
Euclidean distance vs cosine distance:
1.欧式距离的数值受到维度的影响,余弦相似度在高维的情况下也依然保持低维完全相同时相似度为1等性质.
2.欧式距离体现的是距离上的绝对差异,The cosine distance reflects the relative difference in direction.
边栏推荐
- 系统太多,多账号互通如何实现?
- [Dataset][VOC] Rat dataset voc format 3001 sheets
- Shell编程之循环语句
- 【ORACLE】什么时候ROWNUM等于0和ROWNUM小于0,两个条件不等价?
- Climbing Stairs (7/30)
- 实时渲染器不止lumion,Chaos Vantage你值得一试
- Postgresql snapshot optimization Globalvis new system analysis (performance greatly enhanced)
- Protobuf Grpc使用异常 类型有未导出的方法,并且是在不同的软件包中定义
- 字节跳动三面拿offer:网络+IO+redis+JVM+GC+红黑树+数据结构,助你快速进大厂!!
- BinaryIndexedTrees树状数组
猜你喜欢
基于DMS的数仓智能运维服务,知多少?
2022年最新的Android面试大厂必考174题(附带详细答案)
网络协议-TCP、UDP区别及TCP三次握手、四次挥手
不要小看 WebSocket!长连接、有状态、双向、全双工都是王炸技能
京东云发布新一代分布式数据库StarDB 5.0
梅科尔工作室-14天华为培训六
【WPS-OFFICE-Word】 WPS中样式的运作原理?样式自动更新、自动改变如何处理?样式的管理方法?
BinomialTree 二叉树
Zhong Hua, senior architect of Ali: China-Taiwan strategic thinking and architecture practice; including internal implementation manual
【统计机器学习】线性回归模型
随机推荐
力扣刷题之有效的正方形(每日一题7/29)
【计网】二、物理层
The ecological environmental protection management system based on mobile GIS
CC2530_ZigBee+华为云IOT:设计一套属于自己的冷链采集系统
online 方式创建索引触发trigger怎么办?
U-Net生物医学图像分割讲解(Convolutional Networks for BiomedicalImage Segmentation)
【微信小程序】NFC 标签打开小程序
Solution for no navigation bar after Word is saved as PDF
Word另存为PDF后无导航栏解决办法
网络协议-TCP、UDP区别及TCP三次握手、四次挥手
POJ 1465 Multiple(用BFS求能组成的n的最小倍数)
MySQL【变量、流程控制与游标】
力扣刷题之求两数之和
Shell编程案例
POJ 3041 Asteroids(最大匹配数=最小点覆盖)
BinaryIndexedTrees树状数组
剑指Offer 56.数组中数字出现的次数
POJ 2377 Bad Cowtractors(最大生成树)
JumpServer开源堡垒机完成龙芯架构兼容性认证
PreFixSum前缀和