当前位置:网站首页>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.
边栏推荐
- JumpServer开源堡垒机完成龙芯架构兼容性认证
- InnoDB 中不同SQL语句设置的锁
- 【Azure 事件中心】使用Azure AD认证方式创建Event Hub Consume Client + 自定义Event Position
- 阿里二面:多线程间的通信方式有几种?举例说明
- 安装radondb mysql遇到问题
- Shell编程之循环语句
- MySQL如何 drop 大表
- 红日安全内网渗透靶场-VulnStack-1
- MySQL基础
- Bytes to beat three sides take offer: network + GC + + IO + redis + JVM red-black tree + data structure, to help you quickly into the giant!!!!!
猜你喜欢
OneNote 教程,如何在 OneNote 中设置页面格式?
APT级全面免杀与企业纵深防御体系的红蓝对抗
阿里资深架构师钟华曰:中台战略思想与架构实战;含内部实施手册
Matlab论文插图绘制模板第42期—气泡矩阵图(相关系数矩阵图)
Don't look down upon the WebSocket!Long connection, stateful, two-way, full-duplex king is Fried
阿里巴巴政委体系-第九章、阿里政委启示录
2022年7月国产数据库大事记
云图说丨初识华为云微服务引擎CSE
阿里巴巴政委体系-第六章、阿里政委体系运作
梅科尔工作室-14天华为培训六
随机推荐
pytest接口自动化测试框架 | 基于Pytest的Web UI自动化测试框架介绍
The ecological environmental protection management system based on mobile GIS
不要小看 WebSocket!长连接、有状态、双向、全双工都是王炸技能
阿里巴巴政委体系-第八章、阿里政委工作方法论
LeetCode 952. 按公因数计算最大组件大小
Big guy, who is free to help me to see what the problem is, I just read MySQL source print, and I just came into contact with flink.
面试突击:什么是粘包和半包?怎么解决?
[数据集][VOC]老鼠数据集voc格式3001张
基于ck+redash构建MySQL慢日志+审计日志展示平台
2022年7月国产数据库大事记
【C语言学习笔记(六)】分支与跳转(if、else、continue、break、switch)
【ORACLE】什么时候ROWNUM等于0和ROWNUM小于0,两个条件不等价?
Postgresql source code (64) Query execution - data structure and execution process before submodule Executor (2) execution
Postgresql-xl global snapshot and GTM code walking (branch line)
BinaryIndexedTrees树状数组
online 方式创建索引触发trigger怎么办?
开发即时通讯到底需要什么样的技术,需要多久的时间
YAML中多行字符串的配置方法:|+、 |、 |-、 >+、 >、 >-的区别
阿里巴巴政委体系-第五章、阿里政委体系建设
软件测试技术之如何编写测试用例(3)