当前位置:网站首页>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)
边栏推荐
- [daily training] 1175 Prime permutation
- Analyze datahub, a new generation metadata platform of 4.7K star
- Cookie&Session
- 复习专栏之---消息队列
- torch.histc
- FCN full Convolution Network Understanding and Code Implementation (from pytorch Official Implementation)
- 倍福TwinCAT3 Ads相关错误详细列表
- Edge drawing: a combined real-time edge and segment detector
- The combination of applet container technology and IOT
- 5、【WebGIS实战】软件操作篇——服务发布及权限管理
猜你喜欢

Leetcode 128 longest continuous sequence (hash set)

倍福TwinCAT3 Ads相关错误详细列表

How to achieve 0 error (s) and 0 warning (s) in keil5

EtherCAT简介

JUC学习

FCN full Convolution Network Understanding and Code Implementation (from pytorch Official Implementation)

衡量两个向量相似度的方法:余弦相似度、pytorch 求余弦相似度:torch.nn.CosineSimilarity(dim=1, eps=1e-08)

Feign remote call and getaway gateway

pytorch中的双线性插值上采样(Bilinear Upsampling)、F.upsample_bilinear

TEC: Knowledge Graph Embedding with Triple Context
随机推荐
实现pow(x,n)函数
leetcode 1818 绝对值,排序,二分法,最大值
Common interview questions for performance test
数组的includes( )
Basic concept and classification of sorting
How to achieve 0 error (s) and 0 warning (s) in keil5
About the application of MySQL
Mybati SQL statement printing
Hello World generation
Subnet division and subnet summary
Data exchange JSON
Overview of EtherCAT principle
Md5sum operation
C language EXECL function
家居网购项目
RSN:Learning to Exploit Long-term Relational Dependencies in Knowledge Graphs
C#实现图的深度优先遍历--非递归代码
多元线性回归
FCN全卷積網絡理解及代碼實現(來自pytorch官方實現)
Kmeans