当前位置:网站首页>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)
边栏推荐
- 深度学习中的随机种子torch.manual_seed(number)、torch.cuda.manual_seed(number)
- Golang多图生成gif
- Ridge regression and lasso regression
- File upload and download
- pytest-fixture
- Golang multi graph generation gif
- RSN:Learning to Exploit Long-term Relational Dependencies in Knowledge Graphs
- Edge Drawing: A combined real-time edge and segment detector 翻译
- Edlines: a real time line segment detector with a false detection control
- ES6解构语法详解
猜你喜欢

TEC: Knowledge Graph Embedding with Triple Context

排序链表(归并排序)

线程数据共享和安全 -ThreadLocal

Hal library setting STM32 interrupt

文件上传下载

pytorch nn.AdaptiveAvgPool2d(1)

详解Spark运行模式(local+standalone+yarn)

Detailed list of errors related to twincat3 ads of Beifu

深度学习中的随机种子torch.manual_seed(number)、torch.cuda.manual_seed(number)

Home online shopping project
随机推荐
About the application of MySQL
The 'mental (tiring) process' of building kubernetes/kubesphere environment with kubekey
Home online shopping project
JS日常开发小技巧(持续更新)
C#实现图的深度优先遍历--非递归代码
用小程序的技术优势发展产业互联网
文件上传下载
The value of the second servo encoder is linked to the NC virtual axis of Beifu PLC for display
后台系统右边内容如何出现滚动条和解决双滚动条的问题
EDLines: A real-time line segment detector with a false detection control翻译
Ctfshow blasting WP
IPv4 and IPv6, LAN and WAN, gateway, public IP and private IP, IP address, subnet mask, network segment, network number, host number, network address, host address, and IP segment / number - what does
Pyramid Scene Parsing Network【PSPNet】论文阅读
[reading notes] copywriting realization -- four golden steps for writing effective copywriting
Introduction to EtherCAT
The combination of applet container technology and IOT
C#实现基于广度优先BFS求解无权图最短路径----完整程序展示
Include() of array
衡量两个向量相似度的方法:余弦相似度、pytorch 求余弦相似度:torch.nn.CosineSimilarity(dim=1, eps=1e-08)
数据交换 JSON