当前位置:网站首页>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.
边栏推荐
- Word另存为PDF后无导航栏解决办法
- 6000 字+,帮你搞懂互联网架构演变历程!
- 多线程和并发编程(四)
- MySQL 啥时候用表锁,啥时候用行锁?这些你都应该知道吧
- Postgresql中的pg_memory_barrier_impl和C的volatile
- [Azure Event Hub] Create Event Hub Consume Client + Custom Event Position with Azure AD Authentication
- LeetCode 622. 设计循环队列
- 面试突击:什么是粘包和半包?怎么解决?
- 力扣刷题之数组序号计算(每日一题7/28)
- 国产虚拟化云宏CNware WinStack安装体验-5 开启集群HA
猜你喜欢
[Notes] Introduction to machine learning
Alibaba senior experts create a learning architecture from scratch, including Alibaba's internal technology stack PPT, PFD actual combat
系统太多,多账号互通如何实现?
Confused!Ali was abused on the one hand, but was fortunate to be promoted to Huawei's technology, and successfully got the offer, with an annual salary of 40w
微信小程序分享功能
MD5是对称加密还是非对称加密,有什么优缺点
手把手教你定位线上MySQL慢查询问题,包教包会
阿里巴巴政委体系-第九章、阿里政委启示录
LeetCode 952. 按公因数计算最大组件大小
懵逼!阿里一面被虐了,幸获内推华为技术四面,成功拿到offer,年薪40w
随机推荐
X86 function call model analysis
Cobalt Strike (CS) 逆向初探
云图说丨初识华为云微服务引擎CSE
MySQL详细学习教程(建议收藏)
Calculation of the array serial number of Likou brush questions (one question per day 7/28)
Postgresql snapshot optimization Globalvis new system analysis (performance greatly enhanced)
七夕之前,终于整出了带AI的美丽秘笈
MYSQL误删数据恢复
2022年最新的Android面试大厂必考174题(附带详细答案)
LineSegmentTree线段树
机器学习的方法总结
ScrollView嵌套RV,滑动有阻力不顺滑怎么办?
Difference差分数组
Postgresql源码(65)新快照体系Globalvis工作原理分析
【计网】二、物理层
【微信小程序】NFC 标签打开小程序
Execute the mysql script file in the docker mysql container and solve the garbled characters
PreFixSum前缀和
BinomialTree 二叉树
Climbing Stairs (7/30)