当前位置:网站首页>The method to measure the similarity of two vectors: cosine similarity, pytorch calculate cosine similarity: torch nn. CosineSimilarity(dim=1, eps=1e-08)
The method to measure the similarity of two vectors: cosine similarity, pytorch calculate cosine similarity: torch nn. CosineSimilarity(dim=1, eps=1e-08)
2022-07-01 03:33:00 【It's seventh uncle】
more than string phase like degree \color{red}{ Cosine similarity } more than string phase like degree
stay NLP In my mission , Will calculate the similarity of the generated two word vectors , Cosine similarity formula is often used to calculate .
Cosine similarity uses the cosine value of the angle between two vectors in vector space to measure the difference between two individuals . The closer the cosine is to 1, It means that the closer the angle is 0 degree , That is, the more similar the two vectors are , This is called " Cosine similarity ".
We know , For two vectors , If the angle between them is smaller , So we think the more similar these two vectors are . Cosine similarity is the use of this theoretical idea . It measures the similarity between vectors by calculating the cosine of the angle between two vectors .
The formula is as follows :
Reference resources : A way to measure the similarity between two vectors : Cosine similarity
be used for torch Cosine similarity function :
pytorch Cosine similarity :torch.nn.CosineSimilarity(dim=1, eps=1e-08)
边栏推荐
- JUC学习
- Cookie&Session
- How to use hybrid format to output ISO files? isohybrid:command not found
- Research on target recognition and tracking based on 3D laser point cloud
- 10、Scanner.next() 无法读取空格/indexOf -1
- Finally in promise
- 别再说不会解决 “跨域“ 问题啦
- JS日常开发小技巧(持续更新)
- The preorder traversal of leetcode 144 binary tree and the expansion of leetcode 114 binary tree into a linked list
- Introduction and installation of Solr
猜你喜欢

Hal library setting STM32 interrupt

4、【WebGIS实战】软件操作篇——数据导入及处理

手把手带你了解一块电路板,从设计到制作(干货)

Feign remote call and getaway gateway
![[nine day training] content III of the problem solution of leetcode question brushing Report](/img/7e/1e76181e56ef7feb083f9662df71c7.jpg)
[nine day training] content III of the problem solution of leetcode question brushing Report

过滤器 Filter

Explain spark operation mode in detail (local+standalone+yarn)

Redis tutorial

终极套娃 2.0 | 云原生交付的封装

Let's just say I can use thousands of expression packs
随机推荐
go实现命令行的工具cli
shell脚本使用两个横杠接收外部参数
Hello World generation
POI exports excel and displays hierarchically according to parent-child nodes
Edlines: a real time line segment detector with a false detection control
JUC learning
4、【WebGIS实战】软件操作篇——数据导入及处理
深度学习中的随机种子torch.manual_seed(number)、torch.cuda.manual_seed(number)
Avalanche problem and the use of sentinel
ECMAScript 6.0
详解Spark运行模式(local+standalone+yarn)
TEC: Knowledge Graph Embedding with Triple Context
How do I use Google Chrome 11's Upload Folder feature in my own code?
Latest interface automation interview questions
JUC学习
pytorch nn.AdaptiveAvgPool2d(1)
FCN全卷积网络理解及代码实现(来自pytorch官方实现)
Learning notes for introduction to C language multithreaded programming
衡量两个向量相似度的方法:余弦相似度、pytorch 求余弦相似度:torch.nn.CosineSimilarity(dim=1, eps=1e-08)
Cookie&Session