当前位置:网站首页>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 learning
- Nacos
- Feature Pyramid Networks for Object Detection论文理解
- Mybati SQL statement printing
- split(),splice(),slice()傻傻分不清楚?
- 【读书笔记】《文案变现》——写出有效文案的四个黄金步骤
- 监听器 Listener
- C # realize solving the shortest path of unauthorized graph based on breadth first BFS -- complete program display
- How to achieve 0 error (s) and 0 warning (s) in keil5
- EtherCAT原理概述
猜你喜欢

Let's just say I can use thousands of expression packs

LeetCode 31下一个排列、LeetCode 64最小路径和、LeetCode 62不同路径、LeetCode 78子集、LeetCode 33搜索旋转排序数组(修改二分法)

JUC学习
Common interview questions for performance test

数据库中COMMENT关键字的使用

Overview of EtherCAT principle

Keil5中如何做到 0 Error(s), 0 Warning(s).

Introduction to EtherCAT

Asgnet paper and code interpretation 2

复习专栏之---消息队列
随机推荐
pytorch nn.AdaptiveAvgPool2d(1)
Bilinear upsampling and f.upsample in pytorch_ bilinear
手把手带你了解一块电路板,从设计到制作(干货)
后台系统右边内容如何出现滚动条和解决双滚动条的问题
[深度学习]激活函数(Sigmoid等)、前向传播、反向传播和梯度优化;optimizer.zero_grad(), loss.backward(), optimizer.step()的作用及原理
Ridge regression and lasso regression
Gorilla/mux framework (RK boot): RPC error code design
Thread data sharing and security -threadlocal
Introduction to ieda right click source file menu
C语言多线程编程入门学习笔记
FCN全卷積網絡理解及代碼實現(來自pytorch官方實現)
倍福TwinCAT3 Ads相关错误详细列表
数据库DDL(Data Definition Language,数据定义语言)知识点
排序链表(归并排序)
How to use hybrid format to output ISO files? isohybrid:command not found
About the application of MySQL
Avalanche problem and the use of sentinel
【伸手党福利】JSONObject转String保留空字段
Feign远程调用和Getaway网关
C # realize solving the shortest path of unauthorized graph based on breadth first BFS -- complete program display