当前位置:网站首页>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.
边栏推荐
猜你喜欢

阿里巴巴政委体系-第五章、阿里政委体系建设

2022年7月国产数据库大事记

【计网】二、物理层

YAML中多行字符串的配置方法:|+、 |、 |-、 >+、 >、 >-的区别

梅科尔工作室-14天华为培训六

网络协议-TCP、UDP区别及TCP三次握手、四次挥手

6000 字+,帮你搞懂互联网架构演变历程!

idea——同一项目开启多个实例(不同端口)

MySQL详细学习教程(建议收藏)

Alibaba senior experts create a learning architecture from scratch, including Alibaba's internal technology stack PPT, PFD actual combat
随机推荐
MySQL——增删改查进阶
MySQL超详细安装教程 手把手教你安装MySQL到使用MySQL 最简单的MySQL安装方式,这种方式装,卸载也简单
LeetCode 622. 设计循环队列
力扣刷题之合并两个有序数组
Handler 源码解析
[Notes] Introduction to machine learning
Rust:多线程并发编程
2022年7月国产数据库大事记
力扣刷题之爬楼梯(7/30)
POJ 1465 Multiple(用BFS求能组成的n的最小倍数)
一文搞懂│php 中的 DI 依赖注入
软件测试技术之如何编写测试用例(3)
盲僧发现了华点——教你如何使用API接口获取数据
Execute the mysql script file in the docker mysql container and solve the garbled characters
Brush the topic of mobile zero power button
基于移动GIS的环保生态管理系统
Alibaba senior experts create a learning architecture from scratch, including Alibaba's internal technology stack PPT, PFD actual combat
图像超分——Real-ESRGAN快速上手
CC2530_ZigBee+华为云IOT:设计一套属于自己的冷链采集系统
【统计机器学习】线性回归模型